kidcapital
kidcapital

Reputation: 5174

How do you change ActiveAdmin password?

I got ActiveAdmin running with [email protected]//password, but I want to change these credentials. Anyone know how to change them?

Upvotes: 21

Views: 14241

Answers (4)

TonyTakeshi
TonyTakeshi

Reputation: 5929

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

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

Upvotes: 0

bpn
bpn

Reputation: 3232

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

    admin = AdminUser.find_by_email("[email protected]")
    admin.password = "newPassword"
    admin.save

Upvotes: 39

kidcapital
kidcapital

Reputation: 5174

Ended up using an answer from the ActiveAdmin wiki:

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

Upvotes: 0

Sudhir Jonathan
Sudhir Jonathan

Reputation: 17516

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

Find and change this line to whatever you want:

AdminUser.create!(:email => '[email protected]', :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.

Upvotes: 11

Related Questions