【修改】登录市场和方法统一修改

This commit is contained in:
zer0Black
2022-04-17 23:13:28 +08:00
parent b5ac2c4a1b
commit 4dcbaf5b57
9 changed files with 29 additions and 34 deletions
@@ -85,7 +85,7 @@ public class CasClientController {
String token = JwtUtil.sign(sysUser.getUsername(), sysUser.getPassword());
// 设置超时时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
//获取用户部门信息
JSONObject obj = new JSONObject();
@@ -63,8 +63,7 @@ public class NgAlainController {
result.setResult(ls);
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
return result;
return Result.error("操作失败");
}
List<JSONObject> dictlist=new ArrayList<>();
for (DictModel l : ls) {
@@ -83,7 +83,7 @@ public class SysDataLogController {
queryWrapper.eq("data_id", dataId);
List<SysDataLog> list = service.list(queryWrapper);
if(list==null||list.size()<=0) {
result.error500("未找到版本信息");
return Result.error("未找到版本信息");
}else {
result.setResult(list);
result.setSuccess(true);
@@ -118,7 +118,7 @@ public class LoginServiceImpl implements ILoginService {
retryCount = (int) redisUtil.get(RETRY_LOGIN_PREFIX + username);
}
if (retryCount >= RETRY_LOGIN_MAX_COUNT){
return Result.error("密码错误次数过多,请后重试");
return Result.error("密码错误次数过多,请15分钟后重试");
}
//2. 校验用户名或密码是否正确
String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
@@ -127,7 +127,7 @@ public class LoginServiceImpl implements ILoginService {
// 重试登录次数加一
retryCount++;
if( retryCount == 1){
redisUtil.set(RETRY_LOGIN_PREFIX + username,retryCount,60 * 30);
redisUtil.set(RETRY_LOGIN_PREFIX + username,retryCount,60 * 15);
}else {
redisUtil.set(RETRY_LOGIN_PREFIX + username,retryCount,redisUtil.getExpire(RETRY_LOGIN_PREFIX + username));
}
@@ -409,7 +409,7 @@ public class LoginServiceImpl implements ILoginService {
String token = JwtUtil.sign(username, syspassword);
// 设置超时时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
//token 信息
obj.put("token", token);
@@ -496,7 +496,7 @@ public class LoginServiceImpl implements ILoginService {
String token = JwtUtil.sign(username, syspassword);
// 设置token缓存有效时间
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
obj.put("token", token);
obj.put("userInfo", sysUser);