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
Remember me for a year.
-
#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?
100 101 102 |
# File 'lib/clearance/user.rb', line 100 def authenticated?(password) encrypted_password == encrypt(password) end |
#confirm_email! ⇒ Object
Confirm my email.
121 122 123 124 125 |
# File 'lib/clearance/user.rb', line 121 def confirm_email! self.email_confirmed = true self.confirmation_token = nil save(false) end |
#forgot_password! ⇒ Object
Mark my account as forgotten password.
131 132 133 134 |
# File 'lib/clearance/user.rb', line 131 def forgot_password! generate_confirmation_token save(false) end |
#remember_me! ⇒ Object
Remember me for a year.
112 113 114 115 |
# File 'lib/clearance/user.rb', line 112 def remember_me! self.remember_token = encrypt("--#{Time.now.utc}--#{password}--") save(false) end |
#update_password(new_password, new_password_confirmation) ⇒ true, false
Update my password.
142 143 144 145 146 147 148 149 |
# File 'lib/clearance/user.rb', line 142 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 |