mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 06:07:57 +01:00
Fix NPE on recapcha validation
This commit is contained in:
parent
119eb03f53
commit
c55025f07f
@ -102,7 +102,7 @@ public class UserController extends BaseController {
|
|||||||
final String recaptcha = registration.getRecaptcha();
|
final String recaptcha = registration.getRecaptcha();
|
||||||
if (recaptcha != null) {
|
if (recaptcha != null) {
|
||||||
final String reCaptchaResponse = captchaService.verifyRecaptcha(remoteAddress, recaptcha);
|
final String reCaptchaResponse = captchaService.verifyRecaptcha(remoteAddress, recaptcha);
|
||||||
if (!reCaptchaResponse.isEmpty()) {
|
if (reCaptchaResponse != null && !reCaptchaResponse.isEmpty()) {
|
||||||
errors.rejectValue("recaptcha", reCaptchaResponse);
|
errors.rejectValue("recaptcha", reCaptchaResponse);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -6,6 +6,7 @@ import org.apache.http.NameValuePair;
|
|||||||
import org.apache.http.client.fluent.Form;
|
import org.apache.http.client.fluent.Form;
|
||||||
import org.apache.http.client.fluent.Request;
|
import org.apache.http.client.fluent.Request;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -23,6 +24,7 @@ public class RecaptchaService {
|
|||||||
private final static ObjectMapper objectMapper = new ObjectMapper();
|
private final static ObjectMapper objectMapper = new ObjectMapper();
|
||||||
private String recaptchaSecret;
|
private String recaptchaSecret;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public String verifyRecaptcha(@NotNull String ip, @NotNull String recaptcha) {
|
public String verifyRecaptcha(@NotNull String ip, @NotNull String recaptcha) {
|
||||||
|
|
||||||
final List<NameValuePair> build = Form.form()
|
final List<NameValuePair> build = Form.form()
|
||||||
|
Loading…
Reference in New Issue
Block a user