roysathome.net/auth/cryptography.rb

15 lines
345 B
Ruby
Raw Normal View History

2023-12-11 20:56:09 +00:00
require 'bcrypt'
2023-12-12 22:52:36 +00:00
def create_password_for_user(password)
return BCrypt::Password.create(password)
end
def check_password_for_user(user_id, entered_password)
hashed_password = get_user_hashed_password(user_id)
if BCrypt::Password.new(hashed_password) == entered_password
return true
else
return false
end
end