Module: User::Authentication::ClassMethods
- Defined in:
- app/models/user/authentication.rb
Overview
rubocop:todo Style/Documentation
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.
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/models/user/authentication.rb', line 34 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: login) else authenticated = authenticate_by_local(login, password) end end |