Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
mall
Commits
1667a74c
Commit
1667a74c
authored
Aug 19, 2020
by
macro
Browse files
账号禁用问题修复
parent
c4e81fdb
Changes
1
Hide whitespace changes
Inline
Side-by-side
mall-admin/src/main/java/com/macro/mall/service/impl/UmsAdminServiceImpl.java
View file @
1667a74c
...
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
...
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.macro.mall.bo.AdminUserDetails
;
import
com.macro.mall.bo.AdminUserDetails
;
import
com.macro.mall.common.exception.Asserts
;
import
com.macro.mall.dao.UmsAdminPermissionRelationDao
;
import
com.macro.mall.dao.UmsAdminPermissionRelationDao
;
import
com.macro.mall.dao.UmsAdminRoleRelationDao
;
import
com.macro.mall.dao.UmsAdminRoleRelationDao
;
import
com.macro.mall.dto.UmsAdminParam
;
import
com.macro.mall.dto.UmsAdminParam
;
...
@@ -107,7 +108,10 @@ public class UmsAdminServiceImpl implements UmsAdminService {
...
@@ -107,7 +108,10 @@ public class UmsAdminServiceImpl implements UmsAdminService {
try
{
try
{
UserDetails
userDetails
=
loadUserByUsername
(
username
);
UserDetails
userDetails
=
loadUserByUsername
(
username
);
if
(!
passwordEncoder
.
matches
(
password
,
userDetails
.
getPassword
())){
if
(!
passwordEncoder
.
matches
(
password
,
userDetails
.
getPassword
())){
throw
new
BadCredentialsException
(
"密码不正确"
);
Asserts
.
fail
(
"密码不正确"
);
}
if
(!
userDetails
.
isEnabled
()){
Asserts
.
fail
(
"帐号已被禁用"
);
}
}
UsernamePasswordAuthenticationToken
authentication
=
new
UsernamePasswordAuthenticationToken
(
userDetails
,
null
,
userDetails
.
getAuthorities
());
UsernamePasswordAuthenticationToken
authentication
=
new
UsernamePasswordAuthenticationToken
(
userDetails
,
null
,
userDetails
.
getAuthorities
());
SecurityContextHolder
.
getContext
().
setAuthentication
(
authentication
);
SecurityContextHolder
.
getContext
().
setAuthentication
(
authentication
);
...
...
Write
Preview
Supports
Markdown
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