Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
392d800b
Commit
392d800b
authored
Oct 23, 2024
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录错误5次账号锁定
parent
824c3d52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
portal-manager/src/main/java/com/mortals/xhx/module/user/service/impl/UserServiceImpl.java
...mortals/xhx/module/user/service/impl/UserServiceImpl.java
+12
-5
No files found.
portal-manager/src/main/java/com/mortals/xhx/module/user/service/impl/UserServiceImpl.java
View file @
392d800b
...
...
@@ -32,6 +32,7 @@ import com.mortals.xhx.module.user.service.UserService;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -61,6 +62,10 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
@Autowired
private
UserPwdRecordDao
userPwdRecordDao
;
// 当日密码错误次数(默认60分钟)
@Value
(
"${login.errorCount:5}"
)
private
int
ErrorCount
;
/**
* @param data
* @return
...
...
@@ -208,14 +213,16 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
if
(
sysUser
.
getLoginLock
()
==
null
)
{
sysUser
.
setLoginLock
(
0
);
}
//
取消
账户锁定功能
/*
if (sysUser.getLoginLock() == 1 && sysUser.getLockTime() != null) {
//账户锁定功能
if
(
sysUser
.
getLoginLock
()
==
1
&&
sysUser
.
getLockTime
()
!=
null
)
{
String
nowStr
=
DateUtils
.
getCurrStrDate
();
String
loginDateStr
=
DateUtils
.
getDateTime
(
sysUser
.
getLockTime
(),
"yyyy-MM-dd"
);
if
(
nowStr
.
equals
(
loginDateStr
))
{
throw new AppException("此账号当天密码错误次数已达上限,已被锁定");
throw
new
AppException
(
"此账号当天密码错误次数已达上限"
+
ErrorCount
+
"次,已被锁定"
);
}
else
{
sysUser
.
setLoginLock
(
0
);
}
}
*/
}
try
{
if
(
StringUtils
.
isNotEmpty
(
sysUser
.
getSaltKey
()))
{
...
...
@@ -225,7 +232,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
UserEntity
update
=
new
UserEntity
();
update
.
setId
(
sysUser
.
getId
());
update
.
setErrorCount
(
sysUser
.
getErrorCount
()
+
1
);
if
(
update
.
getErrorCount
()
==
5
)
{
if
(
update
.
getErrorCount
()
==
ErrorCount
)
{
update
.
setLoginLock
(
1
);
update
.
setLockTime
(
new
Date
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment