This commit is contained in:
lijiaqi 2023-12-26 17:18:17 +08:00
parent b48dfeb7c2
commit 75ae7333bc
2 changed files with 13 additions and 13 deletions

View File

@ -2,7 +2,7 @@ _pwd=/mnt/demo26.ydool.net
_ip=119.3.109.134
cd ../
mvn clean package
#mvn clean package
scp target/build/*.jar root@${_ip}:${_pwd}
#scp target/build/lib/*.* root@${_ip}:${_pwd}/lib
ssh root@${_ip} "cd ${_pwd}; sh ./start.sh"

View File

@ -77,14 +77,14 @@ public class AuthServiceImpl extends BaseService<UserMapper, User> implements IA
if (!captcha.equalsIgnoreCase(captchaCache)) {
//获取IP失败次数
String cache = (String) redisUtils.getMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip);
Integer failCount = ObjectUtil.isNull(cache)? 0 : Integer.valueOf(cache) ;
Integer failCount = ObjectUtil.isNull(cache)? 1 : Integer.valueOf(cache) ;
if (ObjectUtil.isNull(failCount)) {
failCount = 1;
} else {
failCount++;
}
redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES);
if (failCount >= 5) {
redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES);
redisUtils.setCacheRefresh(RedissonConstant.IP_BLACK_LIST, ip, 20, TimeUnit.MINUTES);
}
return AjaxResult.fail("验证码错误");
@ -103,14 +103,14 @@ public class AuthServiceImpl extends BaseService<UserMapper, User> implements IA
if (ObjectUtil.isNull(loginUser)) {
//获取IP失败次数
String cache = (String) redisUtils.getMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip);
Integer failCount = ObjectUtil.isNull(cache)? 0 : Integer.valueOf(cache) ;
Integer failCount = ObjectUtil.isNull(cache)? 1 : Integer.valueOf(cache) ;
if (ObjectUtil.isNull(failCount)) {
failCount = 1;
} else {
failCount++;
}
redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES);
if (failCount >= 5) {
redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES);
redisUtils.setCacheRefresh(RedissonConstant.IP_BLACK_LIST, ip, 20, TimeUnit.MINUTES);
}
return AjaxResult.fail("账号或者密码错误");
@ -121,14 +121,14 @@ public class AuthServiceImpl extends BaseService<UserMapper, User> implements IA
if (!loginPassword.equals(loginUser.getPassword())) {
//获取IP失败次数
String cache = (String) redisUtils.getMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip);
Integer failCount = ObjectUtil.isNull(cache)? 0 : Integer.valueOf(cache) ;
Integer failCount = ObjectUtil.isNull(cache)? 1 : Integer.valueOf(cache) ;
if (ObjectUtil.isNull(failCount)) {
failCount = 1;
} else {
failCount++;
}
redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES);
if (failCount >= 5) {
redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES);
redisUtils.setCacheRefresh(RedissonConstant.IP_BLACK_LIST, ip, 20, TimeUnit.MINUTES);
}
return AjaxResult.fail("账号或者密码错误");
@ -137,14 +137,14 @@ public class AuthServiceImpl extends BaseService<UserMapper, User> implements IA
if (!loginUser.getStatus()) {
//获取IP失败次数
String cache = (String) redisUtils.getMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip);
Integer failCount = ObjectUtil.isNull(cache)? 0 : Integer.valueOf(cache) ;
Integer failCount = ObjectUtil.isNull(cache)? 1 : Integer.valueOf(cache) ;
if (ObjectUtil.isNull(failCount)) {
failCount = 1;
} else {
failCount++;
}
redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES);
if (failCount >= 5) {
redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES);
redisUtils.setCacheRefresh(RedissonConstant.IP_BLACK_LIST, ip, 20, TimeUnit.MINUTES);
}
return AjaxResult.fail("当前账号已被停用,请联系管理员");
@ -154,14 +154,14 @@ public class AuthServiceImpl extends BaseService<UserMapper, User> implements IA
if (StrUtil.isBlank(loginUser.getRoles())) {
//获取IP失败次数
String cache = (String) redisUtils.getMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip);
Integer failCount = ObjectUtil.isNull(cache)? 0 : Integer.valueOf(cache) ;
Integer failCount = ObjectUtil.isNull(cache)? 1 : Integer.valueOf(cache) ;
if (ObjectUtil.isNull(failCount)) {
failCount = 1;
} else {
failCount++;
}
redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES);
if (failCount >= 5) {
redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES);
redisUtils.setCacheRefresh(RedissonConstant.IP_BLACK_LIST, ip, 20, TimeUnit.MINUTES);
}
return AjaxResult.fail("该用户没有对应的角色,无法登陆系统");
@ -170,14 +170,14 @@ public class AuthServiceImpl extends BaseService<UserMapper, User> implements IA
List<Role> roleList = userService.roleListByUser(loginUser.getId());
if (CollUtil.isEmpty(roleList)) { //获取IP失败次数
String cache = (String) redisUtils.getMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip);
Integer failCount = ObjectUtil.isNull(cache)? 0 : Integer.valueOf(cache) ;
Integer failCount = ObjectUtil.isNull(cache)? 1 : Integer.valueOf(cache) ;
if (ObjectUtil.isNull(failCount)) {
failCount = 1;
} else {
failCount++;
}
redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES);
if (failCount >= 5) {
redisUtils.putMapCache(RedissonConstant.LOGIN_FAIL_COUNT, ip, failCount, 20, TimeUnit.MINUTES);
redisUtils.setCacheRefresh(RedissonConstant.IP_BLACK_LIST, ip, 20, TimeUnit.MINUTES);
}
return AjaxResult.fail("该用户没有对应的角色或角色已被删除或禁用,无法登陆系统");