Module: QuickAuth::Authentic::InstanceMethods
- Defined in:
- lib/quick_auth/authentic.rb
Instance Method Summary collapse
- #authenticated?(pw) ⇒ Boolean
- #password ⇒ Object
- #password=(value) ⇒ Object
- #password_required? ⇒ Boolean
- #reset_perishable_token! ⇒ Object
Instance Method Details
#authenticated?(pw) ⇒ Boolean
55 56 57 |
# File 'lib/quick_auth/authentic.rb', line 55 def authenticated?(pw) self.crypted_password == self.class.digest(pw, self.password_salt) ? true : false end |
#password ⇒ Object
59 60 61 |
# File 'lib/quick_auth/authentic.rb', line 59 def password @password end |
#password=(value) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/quick_auth/authentic.rb', line 63 def password=(value) if value.present? @password = value self.password_salt = self.class.friendly_token self.crypted_password = self.class.digest(value, self.password_salt) end end |
#password_required? ⇒ Boolean
71 72 73 |
# File 'lib/quick_auth/authentic.rb', line 71 def password_required? crypted_password.blank? end |
#reset_perishable_token! ⇒ Object
75 76 77 78 79 |
# File 'lib/quick_auth/authentic.rb', line 75 def reset_perishable_token! self.perishable_token_exp = 1.day.from_now self.perishable_token = self.class.friendly_token save! end |