Module: Devise::Models::PasswordExpirable::InstanceMethods
- Defined in:
- lib/devise_password_expirable/models/password_expirable.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#need_change_password ⇒ Object
set a fake datetime so a password change is needed.
-
#need_change_password! ⇒ Object
set a fake datetime so a password change is needed and save the record.
-
#need_change_password? ⇒ Boolean
is an password change required?.
Instance Method Details
#need_change_password ⇒ Object
set a fake datetime so a password change is needed
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/devise_password_expirable/models/password_expirable.rb', line 38 def need_change_password if self.class.expire_password_after.is_a? Fixnum self.last_password_reset = self.class.expire_password_after.ago end # is date not set it will set default to need set new password next login need_change_password if self.last_password_reset.nil? self.last_password_reset end |
#need_change_password! ⇒ Object
set a fake datetime so a password change is needed and save the record
30 31 32 33 34 35 |
# File 'lib/devise_password_expirable/models/password_expirable.rb', line 30 def need_change_password! if self.class.expire_password_after.is_a? Fixnum need_change_password self.save(:validate => false) end end |
#need_change_password? ⇒ Boolean
is an password change required?
21 22 23 24 25 26 27 |
# File 'lib/devise_password_expirable/models/password_expirable.rb', line 21 def need_change_password? if self.class.expire_password_after.is_a? Fixnum self.last_password_reset.nil? or self.last_password_reset < self.class.expire_password_after.ago else false end end |