Created
March 13, 2016 16:56
-
-
Save sebastjan-hribar/beee1aec40d19d0b2e7b to your computer and use it in GitHub Desktop.
This file contains 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' | |
class Parent | |
include Hanami::Entity | |
attributes :name, :surname, :email, :password, | |
:password_confirmation, :password_reset_token, :password_reset_sent_at | |
attr_reader :password_hash, :password_salt | |
def password_salt | |
unless password.nil? | |
self.password_salt = BCrypt::Engine.generate_salt | |
end | |
end | |
def password_hash(password_salt) | |
unless password.nil? | |
self.password_hash = BCrypt::Engine.hash_secret(password, password_salt) | |
end | |
end | |
#. | |
#. | |
#. | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment