|
@ -79,7 +79,7 @@ public class WlyyIotLoginEndpoint {
|
|
|
headers.set("Pragma", "no-cache");
|
|
|
return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
|
|
|
}
|
|
|
throw new IllegalStateException("验证码发送失败!");
|
|
|
throw new IllegalStateException("验证码发送失败!result:"+ result);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/oauth/captchaAndRegister", method = RequestMethod.POST)
|
|
@ -99,15 +99,21 @@ public class WlyyIotLoginEndpoint {
|
|
|
throw new InvalidRequestException("captcha");
|
|
|
}
|
|
|
Oauth2Envelop<Boolean> oauth2Envelop;
|
|
|
if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
|
|
|
oauth2Envelop = new Oauth2Envelop<>("注册成功", 200, true);
|
|
|
//注册账号
|
|
|
JSONObject jsonObject = userService.createUser(jsonData);
|
|
|
if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
|
|
|
oauth2Envelop = new Oauth2Envelop<>(jsonObject.getString("msg"), ResultStatus.INVALID_GRANT, false);
|
|
|
//判断当前手机号是否注册过
|
|
|
Boolean b = userService.isRegisterUserName(mobile);
|
|
|
if(!b){
|
|
|
oauth2Envelop = new Oauth2Envelop<>("该手机号已注册过,请直接登录!", ResultStatus.INVALID_GRANT, false);
|
|
|
}else {
|
|
|
if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
|
|
|
oauth2Envelop = new Oauth2Envelop<>("注册成功", 200, true);
|
|
|
//注册账号
|
|
|
JSONObject jsonObject = userService.createUser(jsonData);
|
|
|
if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
|
|
|
oauth2Envelop = new Oauth2Envelop<>(jsonObject.getString("msg"), ResultStatus.INVALID_GRANT, false);
|
|
|
}
|
|
|
} else {
|
|
|
oauth2Envelop = new Oauth2Envelop<>("验证码错误", ResultStatus.INVALID_GRANT, false);
|
|
|
}
|
|
|
} else {
|
|
|
oauth2Envelop = new Oauth2Envelop<>("验证码错误", ResultStatus.INVALID_GRANT, false);
|
|
|
}
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.set("Cache-Control", "no-store");
|