Method: ActiveModel::SecurePassword::InstanceMethodsOnActivation#authenticate

Defined in:
lib/active_model/secure_password.rb

#authenticate(unencrypted_password) ⇒ Object

Returns self if the password is correct, otherwise false.



57
58
59
60
61
62
63
# File 'lib/active_model/secure_password.rb', line 57

def authenticate(unencrypted_password)
  if BCrypt::Password.new(password_digest) == unencrypted_password
    self
  else
    false
  end
end