I recently ran a migration to add the following to an existing user
model:
t.string "crypted_password"
t.string "password_salt"
t.string "persistence_token"
There is an existing (cleartext) password field, but authlogic doesn't
seem to be reading that on existing accounts. As a result, all logins
for existing accounts fail.
How can I get authlogic to either use the cleartext passwords, or to
bulk-populate the crypted_password and password_salt fields for existing
accounts?
OTTOMH:
User.find(:all).each do |user|
user.password = user.cleartextpassword
user.password_confirmation = user.cleartextpassword
user.save
end
(the password_confirmation might not be necessary)
Remember authlogic adds its own password method, there might be
unpleasantness if you have a column called password too.
Con
(Con)
November 14, 2009, 2:49pm
3
I recently ran a migration to add the following to an existing user
model:
t.string "crypted_password"
t.string "password_salt"
t.string "persistence_token"
There is an existing (cleartext) password field, but authlogic doesn’t
seem to be reading that on existing accounts. As a result, all logins
for existing accounts fail.
How can I get authlogic to either use the cleartext passwords, or to
bulk-populate the crypted_password and password_salt fields for existing
accounts?
Hi, you might want to take a look at the following screencast:
http://railscasts.com/episodes/160-authlogic
Good luck,
-Conrad
Matt_Jones
(Matt Jones)
November 14, 2009, 5:11pm
4
Don't forget step 2: LART whoever thought a cleartext password field
was a good idea.
--Matt Jones