Migrating old md5 passwords to devise's bcrypt

540 views
Skip to first unread message

Draiken

unread,
Mar 30, 2011, 1:29:21 PM3/30/11
to Devise
Hi, I am migrating our system from Authlogic to Devise, and also we
have an old users database that we need to mantain, but their
passwords were stored with md5.

On authlogic I just created a method to check if crypted password was
empty and his password was == to the md5 one, then set the password
for the recieved one and saved the user, so he now logs in with the
bcrypt password. This method was called on the UserSessions
controller.

Now I am not sure where to put this verification on Devise and I'm
looking for the best solution for this.

Thanks !

José Valim

unread,
Mar 30, 2011, 1:35:12 PM3/30/11
to Devise
There is a valid_password? method in your model were you override it,
call super, and change accordingly.

Draiken

unread,
Mar 30, 2011, 1:55:33 PM3/30/11
to Devise
Worked like a charm, thank you.
Reply all
Reply to author
Forward
0 new messages