Skip to content
Snippets Groups Projects
Unverified Commit e44046e1 authored by Khemissi Amir's avatar Khemissi Amir Committed by GitHub
Browse files

GIT-3085: Fixed the resetting password link constent active state after use (Fixes #3085). (#3087)

parent 34e7584a
No related branches found
No related tags found
No related merge requests found
...@@ -55,9 +55,8 @@ class PasswordResetsController < ApplicationController ...@@ -55,9 +55,8 @@ class PasswordResetsController < ApplicationController
elsif @user.update_attributes(user_params) elsif @user.update_attributes(user_params)
# Clear the user's social uid if they are switching from a social to a local account # Clear the user's social uid if they are switching from a social to a local account
@user.update_attribute(:social_uid, nil) if @user.social_uid.present? @user.update_attribute(:social_uid, nil) if @user.social_uid.present?
# Mark password as secure and deactivate the reset digest in use.
# Mark password as secure @user.update(reset_digest: nil, reset_sent_at: nil, secure_password: true)
@user.update(secure_password: true)
# Successfully reset password # Successfully reset password
return redirect_to root_path, flash: { success: I18n.t("password_reset_success") } return redirect_to root_path, flash: { success: I18n.t("password_reset_success") }
end end
......
...@@ -158,6 +158,7 @@ describe PasswordResetsController, type: :controller do ...@@ -158,6 +158,7 @@ describe PasswordResetsController, type: :controller do
user.reload user.reload
expect(old_digest.eql?(user.password_digest)).to be false expect(old_digest.eql?(user.password_digest)).to be false
expect(user.reset_digest.nil? && user.reset_sent_at.nil?).to be
expect(response).to redirect_to(root_path) expect(response).to redirect_to(root_path)
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment