Module: Clearance::Model::ProtectedInstanceMethods

Defined in:
lib/clearance/model.rb

Instance Method Summary collapse

Instance Method Details

#encrypt_passwordObject



73
74
75
76
# File 'lib/clearance/model.rb', line 73

def encrypt_password
  return if password.blank?
  self.crypted_password = encrypt(password)
end

#initialize_saltObject



69
70
71
# File 'lib/clearance/model.rb', line 69

def initialize_salt
  self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{email}--") if new_record?
end

#password_required?Boolean

Returns:



78
79
80
# File 'lib/clearance/model.rb', line 78

def password_required?
  crypted_password.blank? || !password.blank?
end