FIX: Prefer email when resetting password (#15650)

The UI used to request a password reset by username when the user was
logged in. This did not work when hide_email_already_taken site setting
was enabled, which disables the lookup-by-username functionality.

This commit also introduces a check to ensure that the parameter is an
email when hide_email_already_taken is enabled as the single allowed
type is email (no usernames are allowed).
This commit is contained in:
Dan Ungureanu
2022-01-20 10:04:45 +02:00
committed by GitHub
parent f5ea00c73f
commit 5b7bddf966
3 changed files with 9 additions and 17 deletions

View File

@ -2068,7 +2068,7 @@ describe SessionController do
post "/session/forgot_password.json",
params: { login: user.username }
expect(response.status).to eq(200)
expect(response.status).to eq(400)
expect(Jobs::CriticalUserEmail.jobs.size).to eq(0)
end