Commit 8c7af349 authored by ma's avatar ma

添加验证码校验

parent 02e6217b
......@@ -80,18 +80,18 @@ public class LoginController {
return ResResult.failed().setMsgValue("用户名或密码错误次数达到三次,请三分钟后再重试");
} else {
Date curCodeDate = new Date();
//if (code.equals(UserUtils.getEmailCode(account)) && curCodeDate.before(UserUtils.getEmailCodeExpTime(account))) {
if (code.equals("123456")) {
if (code.equals(UserUtils.getEmailCode(account)) && curCodeDate.before(UserUtils.getEmailCodeExpTime(account))) {
//if (code.equals("123456")) {
String token = JwtUtil.createToken(dbUser);
LoginVo loginVo = new LoginVo();
loginVo.setAuthorization(token);
loginVo.setUpdateTime(user.getUpdateTime());
UserUtils.setToken(dbUser.getUserId(), token);
UserUtils.setTokenExp(dbUser.getUserId(), JwtUtil.getTokenExp());
//UserUtils.removeErrCnt(userName);
//UserUtils.removeCountFreezeDate(userName);
//UserUtils.removeEmailCode(account);
//UserUtils.removeEmailCodeExpTime(account);
UserUtils.removeErrCnt(userName);
UserUtils.removeCountFreezeDate(userName);
UserUtils.removeEmailCode(account);
UserUtils.removeEmailCodeExpTime(account);
log.info("登录成功!生成token!");
return ResResult.success().goRecord(loginVo);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment