Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails Devise, how to unencrypt a password?

in rails 3 devise, a user record has an encrypted_password and a password_salt.

How in the console, can I obtain a user's password? How to unencrypt?

like image 517
AnApprentice Avatar asked Apr 05 '11 17:04

AnApprentice


2 Answers

Devise by default uses the BCrypt algorithm, which AFAIK is not decrypt-able. If you need to be able to decrypt passwords, you need to use a different algorithm such as the AES.

There is a gem which extends AES support for Devise.

Note: I have answered this question in a purely academic interest. It would be recommended you continue to use BCrypt. I encourage you to exercise severe caution, since managing passwords is risky business.

like image 121
Shreyas Avatar answered Sep 21 '22 18:09

Shreyas


Devise uses BCrypt. You need modify the encrypted_password field in the USERS table and put a new encrypted password.

You can generate a new encrypted password in this website: http://www.bcrypt-generator.com/

like image 39
Jaime Rocha Avatar answered Sep 18 '22 18:09

Jaime Rocha