Improve captch erorr handling on invalid input

This commit is contained in:
Paulo Gustavo Veiga 2022-02-12 10:33:05 -08:00
parent 83cff3f66d
commit ccc0b10ea0
3 changed files with 7 additions and 2 deletions

View File

@ -57,8 +57,11 @@ public class RecaptchaService {
if (success != null && !success) {
final List<String> errorCodes = (List<String>) responseBody.get("error-codes");
String errorCode = errorCodes.get(0);
if (errorCode.equals(CATCH_ERROR_CODE_TIMEOUT_OR_DUPLICATE) || errorCodes.equals(CATCHA_ERROR_CODE_INPUT_RESPONSE)) {
if (errorCode.equals(CATCH_ERROR_CODE_TIMEOUT_OR_DUPLICATE)) {
result = Messages.CAPTCHA_TIMEOUT_OUT_DUPLICATE;
} else if (errorCode.equals("invalid-input-response")) {
result = Messages.CAPTCHA_INVALID_INPUT_RESPONSE;
} else {
result = Messages.CAPTCHA_LOADING_ERROR;
logger.error("Unexpected error during catch resolution:" + errorCodes);

View File

@ -28,4 +28,5 @@ public interface Messages {
String CAPTCHA_LOADING_ERROR = "CAPTCHA_LOADING_ERROR";
String CAPTCHA_TIMEOUT_OUT_DUPLICATE = "CAPTCHA_TIMEOUT_OUT_DUPLICATE";
String CAPTCHA_INVALID_INPUT_RESPONSE = "CAPTCHA_INVALID_INPUT_RESPONSE";
}

View File

@ -51,4 +51,5 @@ TRY_WELCOME = This edition space showcases some of the mindmap editor capabiliti
UNEXPECTED_ERROR_DETAILS = Unexpected error processing request.
NO_ENOUGH_PERMISSIONS=This mind map can opened.
NO_ENOUGH_PERMISSIONS_DETAILS=You do not have enough right access to see this map. This map has been changed to private or deleted.
CAPTCHA_TIMEOUT_OUT_DUPLICATE="Please, refresh the page and try again."
CAPTCHA_TIMEOUT_OUT_DUPLICATE=Please, refresh the page and try again.
CAPTCHA_INVALID_INPUT_RESPONSE="Invalid input response, refresh the page and try again.