增加登录限制

This commit is contained in:
weinan2087
2022-11-29 17:08:41 +08:00
parent 5cc22295ba
commit 580769fd7a

View File

@@ -122,8 +122,10 @@ public class SysLoginApi extends ApiBaseController {
return error("由于您登录失败次数过多,账号已被锁定!");
}else{
loginErrorCount = loginErrorCount + 1;
if((6-loginErrorCount) == 1){
redisTemplate.opsForValue().set(CacheName.NAME_USER_LOGIN_ERROR_NUM+account, loginErrorCount+"", 5, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(CacheName.NAME_USER_LOGIN_ERROR_NUM+account, loginErrorCount+"", 5, TimeUnit.MINUTES);
int next = (6-loginErrorCount);
if(next == 0){
return error("账号已被锁定");
}
return error("用户名或密码错误,您还有"+(6-loginErrorCount)+"次登录机会");
}