15 lines
345 B
Ruby
15 lines
345 B
Ruby
require 'bcrypt'
|
|
|
|
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 |