Class: PasswordResetTasks
- Inherits:
-
Volt::Task
- Object
- Volt::Task
- PasswordResetTasks
- Defined in:
- app/user_templates/tasks/password_reset_tasks.rb
Instance Method Summary collapse
Instance Method Details
#reset_password(user_id, token, new_password) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/user_templates/tasks/password_reset_tasks.rb', line 4 def reset_password(user_id, token, new_password) valid = UserTemplates::PasswordResetToken.valid_token_for_user?(user_id, token) if valid Volt. do user = store.users.where(id: user_id).first.sync.buffer user.password = new_password user.save!.then do login_as(user) nil end end else raise "The password reset link has expired." end end |