Created
April 21, 2015 02:22
-
-
Save danmayer/f66782e13bd8c327a9fe to your computer and use it in GitHub Desktop.
setting devise passwords on users from parse and proving it works
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user_pass = "password1" | |
User.where(:email => '[email protected]').first.update(password: user_pass, password_confirmation: user_pass) | |
resource = User.find_by_email("[email protected]") | |
bcrypt = BCrypt::Password.new(resource.encrypted_password) | |
password = BCrypt::Engine.hash_secret("#{user_pass}", bcrypt.salt) | |
valid = Devise.secure_compare(password, resource.encrypted_password) | |
#true | |
#this is from the dev parse export | |
user.update_column(:encrypted_password, '$2a$10$omjZSdTno/pRfPgHcDy2YOA55fTaQQkzRp7ikBmsXc5tiBGwGynzy') | |
resource = User.find_by_email("[email protected]") | |
bcrypt = BCrypt::Password.new(resource.encrypted_password) | |
password = BCrypt::Engine.hash_secret("#{user_pass}", bcrypt.salt) | |
valid = Devise.secure_compare(password, resource.encrypted_password) | |
#true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was to verify an import would work with default bcrypt settings on devise after reading