Todd A. Jacobs
2009-Nov-14 00:01 UTC
authlogic fails on existing accounts when crypted_password is blank
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"
SeanWalberg
2009-Nov-14 14:15 UTC
Re: authlogic fails on existing accounts when crypted_password is blank
On Nov 13, 6:01 pm, "Todd A. Jacobs" <tjacobs-sndr- b4f...-S/bPM5e9wgfNLxjTenLetw@public.gmane.org> wrote:> 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.
Conrad Taylor
2009-Nov-14 14:49 UTC
Re: authlogic fails on existing accounts when crypted_password is blank
On Fri, Nov 13, 2009 at 4:01 PM, Todd A. Jacobs < tjacobs-sndr-b4faac-S/bPM5e9wgfNLxjTenLetw@public.gmane.org> 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? > >Hi, you might want to take a look at the following screencast: http://railscasts.com/episodes/160-authlogic Good luck, -Conrad> -- > "Oh, look: rocks!" > -- Doctor Who, "Destiny of the Daleks" > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Matt Jones
2009-Nov-14 17:11 UTC
Re: authlogic fails on existing accounts when crypted_password is blank
Don''t forget step 2: LART whoever thought a cleartext password field was a good idea. :) --Matt Jones On Nov 14, 9:15 am, SeanWalberg <swalb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Nov 13, 6:01 pm, "Todd A. Jacobs" <tjacobs-sndr- > > b4f...-S/bPM5e9wgfNLxjTenLetw@public.gmane.org> wrote: > > 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.