Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ public void processAction(RequiredActionContext context) {
return;
}
} catch (ModelDuplicateException e) {
String field = switch (e.getDuplicateFieldName()) {
case CredentialModel.USER_LABEL -> Validation.FIELD_OTP_LABEL;
default -> null;
FormMessage formMessage = switch (e.getDuplicateFieldName()) {
case CredentialModel.USER_LABEL -> new FormMessage(Validation.FIELD_OTP_LABEL, Messages.DUPLICATE_TOTP_DEVICE_NAME);
default -> new FormMessage(null, e.getMessage());
};
Response challenge = context.form()
.setAttribute("mode", mode)
.addError(new FormMessage(field, e.getMessage()))
.addError(formMessage)
.createResponse(UserModel.RequiredAction.CONFIGURE_TOTP);
context.challenge(challenge);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public class Messages {
public static final String INVALID_PASSWORD_CONFIRM = "invalidPasswordConfirmMessage";

public static final String INVALID_TOTP = "invalidTotpMessage";
public static final String DUPLICATE_TOTP_DEVICE_NAME = "duplicateTotpDeviceNameMessage";


public static final String USERNAME_EXISTS = "usernameExistsMessage";
public static final String RECAPTCHA_FAILED = "recaptchaFailed";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void setupTotpRegisterDuplicateUserLabel() {

totpPage.configure(totp.generateTOTP(totpPage.getTotpSecret()), "otp");

assertEquals("Device already exists with the same name", totpPage.getInputLabelError());
assertEquals("Device already exists with the same name.", totpPage.getInputLabelError());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ invalidPasswordExistingMessage=Invalid existing password.
invalidPasswordBlacklistedMessage=Invalid password: password is not allowed.
invalidPasswordConfirmMessage=Password confirmation doesn''t match.
invalidTotpMessage=Invalid authenticator code.
duplicateTotpDeviceNameMessage=Device already exists with the same name.

usernameExistsMessage=Username already exists.
emailExistsMessage=This email is already associated with an existing account.
Expand Down
Loading