Thursday, March 10, 2011

resetting password for user in authlogic

I needed to quickly reset a user's password in an Rails application that used authlogic. I didn't have the nice 'request reminder' stuff set up, so I used the console instead:

././script/console production
...
>> forgetfulUser = User.find(:first, :conditions => {:login => 'richard'})
...
...
>> forgetfulUser.password = 'newPassw0rd'
>> forgetfulUser.password_confirmation = 'newPassw0rd'
>> forgetfulUser.save

and it was done.