Module: Minimalist::Authentication::InstanceMethods
- Defined in:
- lib/minimalist/authentication.rb
Instance Method Summary collapse
Instance Method Details
#active? ⇒ Boolean
65 66 67 |
# File 'lib/minimalist/authentication.rb', line 65 def active? active end |
#authenticated?(password) ⇒ Boolean
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/minimalist/authentication.rb', line 69 def authenticated?(password) if crypted_password == encrypt(password) if self.respond_to?(:using_digest_version) and (using_digest_version != PREFERRED_DIGEST_VERSION or salt_cost < CALIBRATED_BCRYPT_COST) new_salt = self.class.make_token self.update_attribute(:crypted_password,self.class.secure_digest(password, new_salt, PREFERRED_DIGEST_VERSION)) self.update_attribute(:salt, new_salt) self.update_attribute(:using_digest_version, PREFERRED_DIGEST_VERSION) end return true else return false end end |
#is_guest? ⇒ Boolean
87 88 89 |
# File 'lib/minimalist/authentication.rb', line 87 def is_guest? email == GUEST_USER_EMAIL end |
#logged_in ⇒ Object
83 84 85 |
# File 'lib/minimalist/authentication.rb', line 83 def logged_in self.class.update_all("last_logged_in_at='#{Time.now.to_s(:db)}'", "id=#{self.id}") # use update_all to avoid updated_on trigger end |