From ff8206323dc1b88c9373a3ee5cf5cb8e86ef60d0 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期六, 30 七月 2022 14:00:32 +0800
Subject: [PATCH] 支持配置密码最大错误次数/锁定时间
---
src/main/java/com/ruoyi/framework/security/service/SysLoginService.java | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/ruoyi/framework/security/service/SysLoginService.java b/src/main/java/com/ruoyi/framework/security/service/SysLoginService.java
index 8f8766c..3261d3b 100644
--- a/src/main/java/com/ruoyi/framework/security/service/SysLoginService.java
+++ b/src/main/java/com/ruoyi/framework/security/service/SysLoginService.java
@@ -22,6 +22,7 @@
import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.framework.redis.RedisCache;
import com.ruoyi.framework.security.LoginUser;
+import com.ruoyi.framework.security.context.AuthenticationContextHolder;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.service.ISysConfigService;
import com.ruoyi.project.system.service.ISysUserService;
@@ -60,9 +61,9 @@
*/
public String login(String username, String password, String code, String uuid)
{
- boolean captchaOnOff = configService.selectCaptchaOnOff();
+ boolean captchaEnabled = configService.selectCaptchaEnabled();
// 楠岃瘉鐮佸紑鍏�
- if (captchaOnOff)
+ if (captchaEnabled)
{
validateCaptcha(username, code, uuid);
}
@@ -70,9 +71,10 @@
Authentication authentication = null;
try
{
+ UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
+ AuthenticationContextHolder.setContext(authenticationToken);
// 璇ユ柟娉曚細鍘昏皟鐢║serDetailsServiceImpl.loadUserByUsername
- authentication = authenticationManager
- .authenticate(new UsernamePasswordAuthenticationToken(username, password));
+ authentication = authenticationManager.authenticate(authenticationToken);
}
catch (Exception e)
{
--
Gitblit v1.9.3