1.remove redisMobileCheckCodeKey in case login success

main
Gary 10 months ago
parent 30e40640c2
commit 3d0ca23f6e

@ -103,7 +103,6 @@ public class LoginController extends BaseController {
@VerifyParam LoginReq loginReq) {
// 得到缓存中的验证码
String redisMobileCheckCodeKey = Constants.REDIS_KEY_MOBILE_CHECK_CODE + loginReq.getDeviceId();
try {
String redisMobileCheckCode = (String) redisTemplate.opsForValue().get(redisMobileCheckCodeKey);
if (StringTools.isEmpty(redisMobileCheckCode)) {
return Result.failed(StatusCode.USER_MOBILE_VERIFICATION_CODE_EXPIRED);
@ -116,10 +115,9 @@ public class LoginController extends BaseController {
loginUserInfo.setLastUseDeviceId(loginReq.getDeviceId());
loginUserInfo.setLastUseDeviceBrand(loginReq.getDeviceBrand());
loginUserInfo.setLastLoginIp(getIpAddr(request));
return Result.success(userInfoService.loginOrRegister(loginUserInfo));
} finally {
String token = userInfoService.loginOrRegister(loginUserInfo);
redisTemplate.delete(redisMobileCheckCodeKey);
}
return Result.success(token);
}
/**

Loading…
Cancel
Save