module OmniAuth::Identity::SecurePassword::InstanceMethodsOnActivation

Public Instance Methods

authenticate(unencrypted_password) click to toggle source

Returns self if the password is correct, otherwise false.

# File lib/omniauth/identity/secure_password.rb, line 60
def authenticate(unencrypted_password)
  if BCrypt::Password.new(password_digest) == unencrypted_password
    self
  else
    false
  end
end
password=(unencrypted_password) click to toggle source

Encrypts the password into the password_digest attribute.

# File lib/omniauth/identity/secure_password.rb, line 69
def password=(unencrypted_password)
  @password = unencrypted_password
  if unencrypted_password && !unencrypted_password.empty?
    self.password_digest = BCrypt::Password.create(unencrypted_password)
  end
end