Module: Devise::Models::LdapAuthenticatable::ClassMethods
- Defined in:
- lib/devise_ldap_authenticatable/model.rb
Instance Method Summary collapse
-
#find_for_ldap_authentication(attributes = {}) ⇒ Object
Find a user for ldap authentication.
- #update_with_password(resource) ⇒ Object
Instance Method Details
#find_for_ldap_authentication(attributes = {}) ⇒ Object
Find a user for ldap authentication.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/devise_ldap_authenticatable/model.rb', line 90 def find_for_ldap_authentication(attributes={}) auth_key = self.authentication_keys.first return nil unless attributes[auth_key].present? auth_key_value = (self.case_insensitive_keys || []).include?(auth_key) ? attributes[auth_key].downcase : attributes[auth_key] auth_key_value = (self.strip_whitespace_keys || []).include?(auth_key) ? auth_key_value.strip : auth_key_value resource = where(auth_key => auth_key_value).first if resource.blank? resource = new resource[auth_key] = auth_key_value resource.password = attributes[:password] end if ::Devise.ldap_create_user && resource.new_record? && resource.valid_ldap_authentication?(attributes[:password]) resource.ldap_before_save if resource.respond_to?(:ldap_before_save) resource.save! end resource end |
#update_with_password(resource) ⇒ Object
113 114 115 |
# File 'lib/devise_ldap_authenticatable/model.rb', line 113 def update_with_password(resource) puts "UPDATE_WITH_PASSWORD: #{resource.inspect}" end |