Last active
April 17, 2019 06:15
-
-
Save takahashilabo/a96110677c4fab6c96c5a2e39313c273 to your computer and use it in GitHub Desktop.
login with bcrypt-ruby
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
| require 'bcrypt' | |
| #signup | |
| signup_password = BCrypt::Password.create("my password") | |
| p signup_password | |
| p signup_password.class | |
| to_db = signup_password.to_s | |
| p to_db | |
| p to_db.class | |
| #login | |
| login_password = BCrypt::Password.new(to_db) | |
| p login_password | |
| p login_password.class | |
| if login_password == "my password" | |
| p "logged in!" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment