Skip to content

Commit 3e1101f

Browse files
vagishaclaude
andcommitted
SignUpController.java: fix Copilot review comments (PR #638, round 1)
* SignUpApiAction.execute: add status="ERROR" to blank-field, bad-email, and send-failure error paths (was inconsistent with captcha path) * verifyCaptcha: use parameterized logging instead of string concatenation * verifyCaptcha: fix typo in comment ("a a" -> "a") Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 495d02e commit 3e1101f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

signup/src/org/labkey/signup/SignUpController.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ else if(form.getEmail() != null && !form.getEmail().equals(form.getEmailConfirm(
642642
}
643643

644644
// On success returns null and clears the session attribute so the captcha cannot be replayed.
645-
// On failure return a a user-facing error message.
645+
// On failure return a user-facing error message.
646646
// Logging matches LoginController's RegisterUserAction.
647647
private String verifyCaptcha(String submittedText, String emailForLogging)
648648
{
@@ -655,7 +655,7 @@ private String verifyCaptcha(String submittedText, String emailForLogging)
655655
}
656656
if (!expected.equalsIgnoreCase(StringUtils.trimToNull(submittedText)))
657657
{
658-
_log.warn("Captcha text did not match for signup attempt for " + emailForLogging);
658+
_log.warn("Captcha text did not match for signup attempt for {}", emailForLogging);
659659
return "Verification text does not match, please retry.";
660660
}
661661
session.removeAttribute(LabKeyKaptchaServlet.SESSION_KEY_VALUE);
@@ -892,13 +892,15 @@ public ApiResponse execute(SignupForm signupForm, BindException errors) throws E
892892
validateSignupForm(signupForm, errors);
893893
if (errors.hasErrors())
894894
{
895+
response.put("status", "ERROR");
895896
response.put("error_message", errorsToMessages(errors));
896897
return response;
897898
}
898899

899900
ValidEmail email = parseAndValidateEmail(signupForm, errors);
900901
if (email == null)
901902
{
903+
response.put("status", "ERROR");
902904
response.put("error_message", errorsToMessages(errors));
903905
return response;
904906
}
@@ -911,6 +913,7 @@ public ApiResponse execute(SignupForm signupForm, BindException errors) throws E
911913

912914
if (!createUserAndSendEmail(signupForm, email, errors))
913915
{
916+
response.put("status", "ERROR");
914917
response.put("error_message", errorsToMessages(errors));
915918
return response;
916919
}

0 commit comments

Comments
 (0)