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.



125
126
127
128
129
130
131
132
133
134
# File 'lib/authlogic/session/password.rb', line 125

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.



137
138
139
140
141
142
143
144
145
146
# File 'lib/authlogic/session/password.rb', line 137

def credentials=(value)
  super
  values = value.is_a?(Array) ? value : [value]
  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



116
117
118
119
120
121
122
# File 'lib/authlogic/session/password.rb', line 116

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)


148
149
150
# File 'lib/authlogic/session/password.rb', line 148

def invalid_password?
  invalid_password == true
end