FIX: ensures invalid OTP blocks submit (#27352)
This commit is contained in:
parent
12661ece97
commit
729063e485
|
@ -93,7 +93,10 @@ export default Controller.extend(PasswordValidation, {
|
||||||
DiscourseURL.redirectTo(result.redirect_to || "/");
|
DiscourseURL.redirectTo(result.redirect_to || "/");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (result.errors && !result.errors.password) {
|
if (
|
||||||
|
result.errors.security_keys ||
|
||||||
|
result.errors.user_second_factors
|
||||||
|
) {
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
secondFactorRequired: this.secondFactorRequired,
|
secondFactorRequired: this.secondFactorRequired,
|
||||||
securityKeyRequired: this.securityKeyRequired,
|
securityKeyRequired: this.securityKeyRequired,
|
||||||
|
|
|
@ -70,6 +70,10 @@
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<h2>{{i18n "user.change_password.choose"}}</h2>
|
<h2>{{i18n "user.change_password.choose"}}</h2>
|
||||||
|
{{#if this.errorMessage}}
|
||||||
|
<div class="alert alert-error">{{this.errorMessage}}</div>
|
||||||
|
<br />
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<PasswordField
|
<PasswordField
|
||||||
|
|
|
@ -187,6 +187,26 @@ shared_examples "login scenarios" do
|
||||||
expect(page).to have_css(".header-dropdown-toggle.current-user")
|
expect(page).to have_css(".header-dropdown-toggle.current-user")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "shows error correctly when TOTP code is invalid" do
|
||||||
|
login_modal.open
|
||||||
|
login_modal.fill_username("john")
|
||||||
|
login_modal.forgot_password
|
||||||
|
find("button.forgot-password-reset").click
|
||||||
|
|
||||||
|
reset_password_link = wait_for_email_link(user, :reset_password)
|
||||||
|
visit reset_password_link
|
||||||
|
|
||||||
|
find(".second-factor-token-input").fill_in(with: "123456")
|
||||||
|
find(".password-reset .btn-primary").click
|
||||||
|
|
||||||
|
expect(page).to have_css(
|
||||||
|
".alert-error",
|
||||||
|
text: "Invalid authentication code. Each code can only be used once.",
|
||||||
|
)
|
||||||
|
|
||||||
|
expect(page).to have_css(".second-factor-token-input")
|
||||||
|
end
|
||||||
|
|
||||||
it "can reset password with a backup code" do
|
it "can reset password with a backup code" do
|
||||||
login_modal.open
|
login_modal.open
|
||||||
login_modal.fill_username("john")
|
login_modal.fill_username("john")
|
||||||
|
|
Loading…
Reference in New Issue