|
@@ -91,15 +91,7 @@ public class LoginController {
|
|
|
return Result.failure("非法用户");
|
|
|
}
|
|
|
|
|
|
-// // 解密密码
|
|
|
-// String password = Base64Converter.decodePassword(param.getPassword());
|
|
|
-//
|
|
|
-// // 验证密码,解密出来是明文密码,在跟输入密码比较
|
|
|
-// boolean decryptName = PasswordUtils.decrypt(entity.getPassword(), password, PasswordUtils.getStaticSalt());
|
|
|
-// if (!decryptName) {
|
|
|
-// log.error("密码错误");
|
|
|
-// return Result.failure("密码错误");
|
|
|
-// }
|
|
|
+
|
|
|
boolean decryptName;
|
|
|
if ("owen".equals(pwdEncrypt)){ // 测试使用
|
|
|
// 不加密
|
|
@@ -146,6 +138,8 @@ public class LoginController {
|
|
|
// 更新到 redis, 有效期24h, 旧token无效, 做单用户登录 86400s-> 24H
|
|
|
redisUtil.set(configConstant.redisPrefix + token, token, 86400);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
return Result.success(result);
|
|
|
|
|
|
}
|
|
@@ -180,86 +174,6 @@ public class LoginController {
|
|
|
return Result.success(o != null);
|
|
|
}
|
|
|
|
|
|
-// @ApiOperation(value = "test-登录", notes = "密码没有经过前端加密")
|
|
|
-// @PostMapping(value = "test/admin/login")
|
|
|
-// public Result testLogin(@Valid @RequestBody LoginDto param) {
|
|
|
-//
|
|
|
-// String from = param.getFrom();
|
|
|
-// String[] checkFrom = {"cms","web"};
|
|
|
-// List<String> fromList = Arrays.asList(checkFrom);
|
|
|
-// if (!fromList.contains(from)) {
|
|
|
-// log.error("from: {}", from);
|
|
|
-// return Result.failure("非法用户");
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 1.获取用户
|
|
|
-// SysUserEntity entity = userService.findByUserName(param.getUserName());
|
|
|
-// if (entity == null){
|
|
|
-// log.error("用户不存在");
|
|
|
-// return Result.failure("用户不存在");
|
|
|
-// }
|
|
|
-//
|
|
|
-// Long userId = entity.getId();
|
|
|
-// Object role = getRoleKey(userId);
|
|
|
-// log.info("role: {}", role);
|
|
|
-//
|
|
|
-// if ("cms".equals(from) && ((Set)role).contains("sys_visitor")) {
|
|
|
-// log.error("游客不能登录管理后台");
|
|
|
-// return Result.failure("非法用户");
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 验证密码,解密出来是明文密码,在跟输入密码比较
|
|
|
-// boolean decryptName = PasswordUtils.decrypt(entity.getPassword(), param.getPassword(), PasswordUtils.getStaticSalt());
|
|
|
-// if (!decryptName) {
|
|
|
-// log.error("密码错误");
|
|
|
-// return Result.failure("密码错误");
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 检查账号是否启用
|
|
|
-// if (entity.getIsEnabled() != 1) {
|
|
|
-// log.error("此账号已停用: {}", entity.getUserName());
|
|
|
-// return Result.failure("此账号已停用");
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 创建新token
|
|
|
-// HashMap<String, Object> tokenMap = new HashMap<>();
|
|
|
-// tokenMap.put("userName", entity.getUserName());
|
|
|
-// tokenMap.put("id", userId);
|
|
|
-// tokenMap.put("role", role);
|
|
|
-//
|
|
|
-// // 记录登录时长
|
|
|
-// Long startTime = System.currentTimeMillis();
|
|
|
-// tokenMap.put("startTime", startTime);
|
|
|
-// log.info("登录起始时间戳:{}", startTime);
|
|
|
-//
|
|
|
-// String token = JwtUtil.createJWT(TOKEN_EXPIRE, tokenMap);
|
|
|
-//
|
|
|
-//
|
|
|
-// HashMap<String, Object> result = new HashMap<>();
|
|
|
-// result.put("user", entity);
|
|
|
-// result.put("token", token);
|
|
|
-// // 角色控制系统管理(sys_admin)、内容管理
|
|
|
-// result.put("role", role);
|
|
|
-//
|
|
|
-//
|
|
|
-// // 保存操作日志
|
|
|
-// saveLog(userId);
|
|
|
-//
|
|
|
-// // 检查更新军衔等级
|
|
|
-// userService.updateLevel(userId);
|
|
|
-//
|
|
|
-//
|
|
|
-// // 更新到 redis, 有效期24h, 旧token无效, 做单用户登录 86400s-> 24H
|
|
|
-// redisUtil.set(configConstant.redisPrefix + token, token, 86400);
|
|
|
-//
|
|
|
-//
|
|
|
-// return Result.success(result);
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
|