So just an update if someone might need this in the future.
Since the you can't normally place back an encrypted password back on the password field for update, I figured the other workaround is to be able to HIDE the two password fields on update and have a separate action for it that only the user can actually change the password through his/her email.
In ActiveAdmin I wrote the form like this:
form do |f|
f.inputs 'Admin Details' do
f.input :email
if f.object.new_record?
f.input :password, as: :password
f.input :password_confirmation, :label => "Password Confirmation"
end
end
f.actions
end
The roadblock for this solution is the validation. I must be able to allow the user to update the other fields without the need to update the password everytime. It's not a perfect solution but I only validate their presence on create.
validates :password,
presence: {
:message => 'Password cannot be blank'
},
:confirmation => true,
on: :create
validates :password,
:confirmation => {
case_sensitive: true
},
:length => {
:within => 8..128,
too_short: "Password is too short (minimum is 8 characters)",
too_long: "Password is too long (maximum is 128 characters)"
},
:unless => lambda{ |adminuser| adminuser.password.blank? },
on: :create
validates :password_confirmation,
presence: {
:message => 'Field cannot be blank'
},
on: :create
So yeah, it's sending change password instructions through email by passing a token