|
@ -69,7 +69,7 @@ public class WlyyIotLoginEndpoint {
|
|
|
String text = parameters.get("text");
|
|
|
|
|
|
if(!verifyCaptcha(key,text)){
|
|
|
throw new ImgCaptchaException("验证码错误!");
|
|
|
throw new ImgCaptchaException("图形验证码错误!");
|
|
|
}
|
|
|
|
|
|
//验证请求间隔超时,防止频繁获取验证码
|
|
@ -97,6 +97,9 @@ public class WlyyIotLoginEndpoint {
|
|
|
|
|
|
public boolean verifyCaptcha(String key,String text){
|
|
|
boolean pass = false;
|
|
|
if(StringUtils.isEmpty(key)||StringUtils.isEmpty(text)){
|
|
|
return false;
|
|
|
}
|
|
|
String captcha = redisTemplate.opsForValue().get(key);
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(captcha)&& captcha.equals(text.toLowerCase())){
|
|
|
pass = true;
|
|
@ -127,7 +130,7 @@ public class WlyyIotLoginEndpoint {
|
|
|
String text = parameters.get("text");
|
|
|
|
|
|
if(!verifyCaptcha(key,text)){
|
|
|
throw new ImgCaptchaException("验证码错误!");
|
|
|
throw new ImgCaptchaException("图形验证码错误!");
|
|
|
}
|
|
|
|
|
|
Oauth2Envelop<Boolean> oauth2Envelop;
|
|
@ -144,7 +147,7 @@ public class WlyyIotLoginEndpoint {
|
|
|
oauth2Envelop = new Oauth2Envelop<>(jsonObject.getString("msg"), ResultStatus.INVALID_GRANT, false);
|
|
|
}
|
|
|
} else {
|
|
|
oauth2Envelop = new Oauth2Envelop<>("验证码错误", ResultStatus.INVALID_GRANT, false);
|
|
|
oauth2Envelop = new Oauth2Envelop<>("短信验证码错误", ResultStatus.INVALID_GRANT, false);
|
|
|
}
|
|
|
}
|
|
|
HttpHeaders headers = new HttpHeaders();
|