Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include BCrypt
- #requires username column on Users table
- def self.authenticate(username, password)
- user = User.find_by(username: username)
- if user
- return user if user.password == password
- end
- end
- def password
- @password ||= Password.new(password_hash)
- end
- #requires password_hash column on Users table
- def password=(new_password)
- @password = Password.create(new_password)
- self.password_hash = @password
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement