mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-21 21:57:56 +01:00
Improve captcha error processing.
This commit is contained in:
parent
6c808dfc2a
commit
b67cd407a4
@ -23,6 +23,8 @@ public class RecaptchaService {
|
||||
"https://www.google.com/recaptcha/api/siteverify";
|
||||
|
||||
private final static ObjectMapper objectMapper = new ObjectMapper();
|
||||
public static final String CATCH_ERROR_CODE_TIMEOUT_OR_DUPLICATE = "timeout-or-duplicate";
|
||||
public static final String CATCHA_ERROR_CODE_INPUT_RESPONSE = "invalid-input-response";
|
||||
private String recaptchaSecret;
|
||||
|
||||
@Nullable
|
||||
@ -54,7 +56,8 @@ public class RecaptchaService {
|
||||
final Boolean success = (Boolean) responseBody.get("success");
|
||||
if (success != null && !success) {
|
||||
final List<String> errorCodes = (List<String>) responseBody.get("error-codes");
|
||||
if (errorCodes.get(0).equals("timeout-or-duplicate")) {
|
||||
String errorCode = errorCodes.get(0);
|
||||
if (errorCode.equals(CATCH_ERROR_CODE_TIMEOUT_OR_DUPLICATE) || errorCodes.equals(CATCHA_ERROR_CODE_INPUT_RESPONSE)) {
|
||||
result = Messages.CAPTCHA_TIMEOUT_OUT_DUPLICATE;
|
||||
} else {
|
||||
result = Messages.CAPTCHA_LOADING_ERROR;
|
||||
|
Loading…
Reference in New Issue
Block a user