@@ -110,6 +110,20 @@ public class UserController extends BaseController{
|
|||||||
// 如果新密码为空,则不更换密码
|
// 如果新密码为空,则不更换密码
|
||||||
if (StringUtils.isNotBlank(user.getNewPassword())) {
|
if (StringUtils.isNotBlank(user.getNewPassword())) {
|
||||||
user.setPassword(StringUtils.entryptPassword(user.getNewPassword()));
|
user.setPassword(StringUtils.entryptPassword(user.getNewPassword()));
|
||||||
|
|
||||||
|
//密码修改之后,更新此用户的redis缓存
|
||||||
|
RealmSecurityManager securityManager = (RealmSecurityManager) SecurityUtils.getSecurityManager();
|
||||||
|
Collection<Realm> realm = securityManager.getRealms();
|
||||||
|
for (Realm realm2 : realm) {
|
||||||
|
SystemAuthorizingRealm userRealm = (SystemAuthorizingRealm) realm2;
|
||||||
|
RedisCache<Object, AuthenticationInfo> cache = (RedisCache<Object, AuthenticationInfo>) userRealm.getAuthenticationCache();
|
||||||
|
String keyPrefix = cache.getKeyPrefix();
|
||||||
|
for (AuthenticationInfo auth : cache.values()) {
|
||||||
|
userRealm.getAuthenticationCache().remove(auth.getPrincipals().getPrimaryPrincipal());
|
||||||
|
}
|
||||||
|
systemService.deleteAuthenticationCache(keyPrefix + user.getName());
|
||||||
|
systemService.deleteAuthenticationCache(keyPrefix + user.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*if (!beanValidator(model, user)){
|
/*if (!beanValidator(model, user)){
|
||||||
return form(user, model);
|
return form(user, model);
|
||||||
|
|||||||
Reference in New Issue
Block a user