如何更改ActiveAdmin密码?

时间:2021-12-15 22:50:03

I got ActiveAdmin running with admin@example.com//password, but I want to change these credentials. Anyone know how to change them?

我让ActiveAdmin运行admin@example.com// password.com,但是我想更改这些凭据。有人知道如何改变他们吗?

4 个解决方案

#1


29  

Best way to do this would be to change it from the rails console :

最好的方法是从rails控制台更改它:

    admin = AdminUser.find_by_email("admin@domain.com")
    admin.password = "newPassword"
    admin.save

#2


9  

When you install ActiveAdmin using the generator, you'll find a migration called {timestamp}_devise_create_admin_users.rb in your db/migrate folder.

当您使用生成器安装ActiveAdmin时,您将发现一个名为{timestamp}_devise_create_admin_users的迁移。db/migrate文件夹中的rb。

Find and change this line to whatever you want:

找到并改变这条线到任何你想要的:

AdminUser.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password')

Keep in mind though, that this is just the seed password, and is being exposed as plaintext. What you might want to do is set up the Devise controllers to have a password change action. Check out the wiki and the Railscast for help.

但是请记住,这只是种子密码,并且是以明文形式公开的。您可能想要做的是设置设计控制器,使其具有密码更改操作。看看维基和铁路广播的帮助。

#3


0  

Add this at app/admin/admin_users.rb will enable change password for edit admin user.

添加这个应用程序/管理/ admin_users。rb将为编辑管理员用户启用更改密码。

ActiveAdmin.register AdminUser do
  index do
    column :email
    column :current_sign_in_at
    column :last_sign_in_at
    column :sign_in_count
    default_actions
  end

  form do |f|
    f.inputs "Admin Details" do
      f.input :email
      f.input :password
    end
    f.buttons
  end  
end

#4


-1  

Ended up using an answer from the ActiveAdmin wiki:

最后使用了ActiveAdmin wiki给出的答案:

https://github.com/gregbell/active_admin/wiki/Your-First-Admin-Resource%3A-AdminUser

https://github.com/gregbell/active_admin/wiki/Your-First-Admin-Resource%3A-AdminUser

#1


29  

Best way to do this would be to change it from the rails console :

最好的方法是从rails控制台更改它:

    admin = AdminUser.find_by_email("admin@domain.com")
    admin.password = "newPassword"
    admin.save

#2


9  

When you install ActiveAdmin using the generator, you'll find a migration called {timestamp}_devise_create_admin_users.rb in your db/migrate folder.

当您使用生成器安装ActiveAdmin时,您将发现一个名为{timestamp}_devise_create_admin_users的迁移。db/migrate文件夹中的rb。

Find and change this line to whatever you want:

找到并改变这条线到任何你想要的:

AdminUser.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password')

Keep in mind though, that this is just the seed password, and is being exposed as plaintext. What you might want to do is set up the Devise controllers to have a password change action. Check out the wiki and the Railscast for help.

但是请记住,这只是种子密码,并且是以明文形式公开的。您可能想要做的是设置设计控制器,使其具有密码更改操作。看看维基和铁路广播的帮助。

#3


0  

Add this at app/admin/admin_users.rb will enable change password for edit admin user.

添加这个应用程序/管理/ admin_users。rb将为编辑管理员用户启用更改密码。

ActiveAdmin.register AdminUser do
  index do
    column :email
    column :current_sign_in_at
    column :last_sign_in_at
    column :sign_in_count
    default_actions
  end

  form do |f|
    f.inputs "Admin Details" do
      f.input :email
      f.input :password
    end
    f.buttons
  end  
end

#4


-1  

Ended up using an answer from the ActiveAdmin wiki:

最后使用了ActiveAdmin wiki给出的答案:

https://github.com/gregbell/active_admin/wiki/Your-First-Admin-Resource%3A-AdminUser

https://github.com/gregbell/active_admin/wiki/Your-First-Admin-Resource%3A-AdminUser