module ActiveModel::SecurePassword::InstanceMethodsOnActivation
Public Instance Methods
authenticate(unencrypted_password)
click to toggle source
Returns self if the password is correct, otherwise false.
# 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
password=(unencrypted_password)
click to toggle source
Encrypts the password into the password_digest attribute.
# File lib/active_model/secure_password.rb, line 66 def password=(unencrypted_password) @password = unencrypted_password unless unencrypted_password.blank? self.password_digest = BCrypt::Password.create(unencrypted_password) end end