提交 4a84bf4d authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 fa922dc8
......@@ -3,6 +3,8 @@ package com.zrqx.resource.bg.controller.user;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
......@@ -23,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.resource.ResourceRequestPath;
import com.zrqx.core.constant.sysuser.SysUserRequestPath;
import com.zrqx.core.enums.ResponseCodeEnum;
import com.zrqx.core.exception.BaseException;
import com.zrqx.core.form.sysuser.bg.user.UpdatePasswordForm;
import com.zrqx.core.form.sysuser.bg.user.UpdateUserBasicsForm;
......@@ -68,16 +71,27 @@ public class UserController {
throw new BaseException("验证码不能为空");
}
String errorCount = stringRedisTemplate.opsForValue().get(name);
if(StringUtils.isNotBlank(errorCount) && Integer.parseInt(errorCount) >=3){
throw new BaseException("密码错误次数过多");
if(StringUtils.isNotBlank(errorCount) && Integer.parseInt(errorCount) >=5){
throw new BaseException(ResponseCodeEnum.VALIDATE);//密码输入错误次数过多,输入验证码
}
String redisCode = stringRedisTemplate.opsForValue().get(uuid);
if(code == null || redisCode == null || !code.toLowerCase().equals(redisCode.toLowerCase())){
throw new BaseException("验证码有误");
if(StringUtils.isNotBlank(errorCount) && Integer.parseInt(errorCount) >=5){
String redisCode = stringRedisTemplate.opsForValue().get(uuid);
if(code == null || redisCode == null || !code.toLowerCase().equals(redisCode.toLowerCase())){
throw new BaseException("验证码有误");
}
}
stringRedisTemplate.delete(uuid);
User user = userSerivce.login(name);
//查看账号是否冻结
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if((new Date().getTime()-format.parse(user.getFreezetime().toString()).getTime()>6*60*1000)){
user.setFreezetime(null);
userSerivce.updateByCriteria(user);
}
if(StringUtils.isNotBlank(errorCount) && Integer.parseInt(errorCount) >=15){
user.setFreezetime(new Date());
throw new BaseException("您的账号已冻结,密码输入次数超过15次,请10分钟以后在再来登录");
}
if(user == null){
throw new BaseException("账号或密码错误");
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论