mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 17:20:23 +08:00
FIX: Don't redirect to wizard when resetting password
This commit is contained in:
parent
d326784ecf
commit
54bb2a6bc2
|
@ -434,7 +434,7 @@ class UsersController < ApplicationController
|
|||
else
|
||||
store_preloaded("password_reset", MultiJson.dump({ is_developer: UsernameCheckerService.is_developer?(@user.email) }))
|
||||
end
|
||||
return redirect_to(wizard_path) if Wizard.user_requires_completion?(@user)
|
||||
return redirect_to(wizard_path) if request.put? && Wizard.user_requires_completion?(@user)
|
||||
end
|
||||
|
||||
format.json do
|
||||
|
|
|
@ -307,12 +307,23 @@ describe UsersController do
|
|||
expect(user.user_auth_tokens.count).to eq(1)
|
||||
end
|
||||
|
||||
it "doesn't redirect to wizard on get" do
|
||||
user = Fabricate(:admin)
|
||||
UserAuthToken.generate!(user_id: user.id)
|
||||
|
||||
token = user.email_tokens.create(email: user.email).token
|
||||
get :password_reset, token: token
|
||||
expect(response).not_to redirect_to(wizard_path)
|
||||
end
|
||||
|
||||
it "redirects to the wizard if you're the first admin" do
|
||||
user = Fabricate(:admin)
|
||||
UserAuthToken.generate!(user_id: user.id)
|
||||
|
||||
token = user.email_tokens.create(email: user.email).token
|
||||
get :password_reset, token: token
|
||||
put :password_reset, token: token, password: 'hg9ow8yhg98oadminlonger'
|
||||
expect(response).to be_redirect
|
||||
expect(response).to redirect_to(wizard_path)
|
||||
end
|
||||
|
||||
it "doesn't invalidate the token when loading the page" do
|
||||
|
|
Loading…
Reference in New Issue
Block a user