Module: Authlogic::Session::Password::InstanceMethods

Defined in:
lib/authlogic/session/password.rb

Overview

Password related instance methods

Instance Method Summary collapse

Instance Method Details

#credentialsObject

Returns the login_field / password_field credentials combination in hash form.



131
132
133
134
135
136
137
138
139
140
# File 'lib/authlogic/session/password.rb', line 131

def credentials
  if authenticating_with_password?
    details = {}
    details[.to_sym] = send()
    details[password_field.to_sym] = "<protected>"
    details
  else
    super
  end
end

#credentials=(value) ⇒ Object

Accepts the login_field / password_field credentials combination in hash form.



143
144
145
146
147
148
149
150
151
152
153
# File 'lib/authlogic/session/password.rb', line 143

def credentials=(value)
  super
  values = parse_param_val(value) # add strong parameters check

  if values.first.is_a?(Hash)
    values.first.with_indifferent_access.slice(, password_field).each do |field, value|
      next if value.blank?
      send("#{field}=", value)
    end
  end
end

#initialize(*args) ⇒ Object



122
123
124
125
126
127
128
# File 'lib/authlogic/session/password.rb', line 122

def initialize(*args)
  if !self.class.configured_password_methods
    configure_password_methods
    self.class.configured_password_methods = true
  end
  super
end

#invalid_password?Boolean

Returns:

  • (Boolean)


155
156
157
# File 'lib/authlogic/session/password.rb', line 155

def invalid_password?
  invalid_password == true
end