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?
–
“Oh, look: rocks!”
– Doctor Who, “Destiny of the Daleks”
Todd A. Jacobs wrote:
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?
–
“Oh, look: rocks!”
– Doctor Who, “Destiny of the Daleks”
I think I’d back out the migration and redo it, writing a step in the
migration so that you automatically populate the salt, generate and
store the new crypted_password for all your existing accounts when the
migration is run (and scrub those cleartext passwords). You should be
able to look at authlogic to see how it is done on account creation.
Then all the accounts are on the same playing field, and you don’t have
to modify authlogic.
Test extensively of course before doing this in your ‘live’ environment.