Method: Authlogic::ActsAsAuthentic::Password::Methods::InstanceMethods#valid_password?
- Defined in:
- lib/authlogic/acts_as_authentic/password.rb
#valid_password?(attempted_password, check_against_database = check_passwords_against_database? ) ⇒ Boolean
Accepts a raw password to determine if it is the correct password.
-
attempted_password [String] - password entered by user
-
check_against_database [boolean] - Should we check the password against the value in the database or the value in the object? Default taken from config option check_passwords_against_database. See config method for more information.
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/authlogic/acts_as_authentic/password.rb', line 217 def valid_password?( attempted_password, check_against_database = check_passwords_against_database? ) crypted = crypted_password_to_validate_against(check_against_database) return false if attempted_password.blank? || crypted.blank? run_callbacks :password_verification do crypto_providers.each_with_index.any? do |encryptor, index| if encryptor_matches?( crypted, encryptor, attempted_password, check_against_database ) if transition_password?(index, encryptor, check_against_database) transition_password(attempted_password) end true else false end end end end |