Module: Clearance::User::InstanceMethods
- Defined in:
- lib/clearance/user.rb
Instance Method Summary collapse
-
#authenticated?(password) ⇒ true, false
Am I authenticated with given password?.
-
#confirm_email! ⇒ Object
Confirm my email.
-
#forgot_password! ⇒ Object
Mark my account as forgotten password.
-
#remember_me! ⇒ Object
deprecated
Deprecated.
Use #reset_remember_token! instead
-
#reset_remember_token! ⇒ Object
Reset the remember token.
-
#update_password(new_password, new_password_confirmation) ⇒ true, false
Update my password.
Instance Method Details
#authenticated?(password) ⇒ true, false
Am I authenticated with given password?
83 84 85 |
# File 'lib/clearance/user.rb', line 83 def authenticated?(password) encrypted_password == encrypt(password) end |
#confirm_email! ⇒ Object
Confirm my email.
108 109 110 111 112 |
# File 'lib/clearance/user.rb', line 108 def confirm_email! self.email_confirmed = true self.confirmation_token = nil save(:validate => false) end |
#forgot_password! ⇒ Object
Mark my account as forgotten password.
118 119 120 121 |
# File 'lib/clearance/user.rb', line 118 def forgot_password! generate_confirmation_token save(:validate => false) end |
#remember_me! ⇒ Object
Deprecated.
Use #reset_remember_token! instead
Set the remember token.
90 91 92 93 |
# File 'lib/clearance/user.rb', line 90 def remember_me! warn "[DEPRECATION] remember_me!: use reset_remember_token! instead" reset_remember_token! end |
#reset_remember_token! ⇒ Object
Reset the remember token.
99 100 101 102 |
# File 'lib/clearance/user.rb', line 99 def reset_remember_token! generate_remember_token save(:validate => false) end |
#update_password(new_password, new_password_confirmation) ⇒ true, false
Update my password.
129 130 131 132 133 134 135 136 |
# File 'lib/clearance/user.rb', line 129 def update_password(new_password, new_password_confirmation) self.password = new_password self.password_confirmation = new_password_confirmation if valid? self.confirmation_token = nil end save end |