Module: User::Authentication::ClassMethods
- Defined in:
- app/models/user/authentication.rb
Instance Method Summary collapse
-
#authenticate(login, password) ⇒ Object
Authenticates a user by their login name and unencrypted password.
Instance Method Details
#authenticate(login, password) ⇒ Object
Authenticates a user by their login name and unencrypted password. Returns the user or nil.
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/models/user/authentication.rb', line 38 def authenticate(login, password) case configatron.authentication when 'ldap' authenticated = authenticate_with_ldap(login, password) authenticated ? register_or_update_via_ldap(login) : nil when 'none' raise StandardError, 'Can only disable authentication in development' unless Rails.env.development? User.find_by(login:) else authenticated = authenticate_by_local(login, password) end end |