Module: Impresser::Authenticate::ClassMethods
- Defined in:
- lib/impresser/mixin/authenticate.rb
Instance Method Summary collapse
- #authenticate(login, password) ⇒ Object
- #find_user_for_authentication(login) ⇒ Object
- #hasher ⇒ Object
Instance Method Details
#authenticate(login, password) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/impresser/mixin/authenticate.rb', line 19 def authenticate(login, password) user = find_user_for_authentication(login) if user && hasher.check(password, user.user_pass) return user else return nil end end |
#find_user_for_authentication(login) ⇒ Object
11 12 13 |
# File 'lib/impresser/mixin/authenticate.rb', line 11 def find_user_for_authentication(login) raise NotImplementedError, "Your User class must implement the find_user_for_authentication method" end |
#hasher ⇒ Object
15 16 17 |
# File 'lib/impresser/mixin/authenticate.rb', line 15 def hasher @hasher ||= Phpass.new end |