Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
494b2b01
MaxKey
项目概览
yujianwangzivayy
/
MaxKey
与 Fork 源项目一致
Fork自
MaxKey单点登录官方(MaxKeyTop) / MaxKey
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
494b2b01
编写于
7月 31, 2021
作者:
M
MaxKey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PasswordSetType
上级
8210d11f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
12 deletion
+16
-12
maxkey-persistence/src/main/java/org/maxkey/persistence/service/UserInfoService.java
.../java/org/maxkey/persistence/service/UserInfoService.java
+5
-3
maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/UserInfoMapper.xml
...rg/maxkey/persistence/mapper/xml/mysql/UserInfoMapper.xml
+6
-6
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/SafeController.java
...c/main/java/org/maxkey/web/contorller/SafeController.java
+3
-3
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/UserInfoController.java
...in/java/org/maxkey/web/contorller/UserInfoController.java
+2
-0
未找到文件。
maxkey-persistence/src/main/java/org/maxkey/persistence/service/UserInfoService.java
浏览文件 @
494b2b01
...
...
@@ -214,9 +214,10 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
}
public
boolean
changePassword
(
String
oldPassword
,
String
newPassword
,
String
confirmPassword
)
{
public
boolean
changePassword
(
String
oldPassword
,
String
newPassword
,
String
confirmPassword
,
int
passwordSetType
)
{
try
{
WebContext
.
setAttribute
(
PasswordPolicyValidator
.
PASSWORD_POLICY_VALIDATE_RESULT
,
""
);
UserInfo
userInfo
=
WebContext
.
getUserInfo
();
...
...
@@ -225,6 +226,7 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
changeUserInfo
.
setPassword
(
newPassword
);
changeUserInfo
.
setId
(
userInfo
.
getId
());
changeUserInfo
.
setDecipherable
(
userInfo
.
getDecipherable
());
changeUserInfo
.
setPasswordSetType
(
passwordSetType
);
if
(
newPassword
.
equals
(
confirmPassword
)){
if
(
oldPassword
==
null
||
...
...
maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/UserInfoMapper.xml
浏览文件 @
494b2b01
...
...
@@ -95,12 +95,12 @@
<update
id=
"changePassword"
parameterType=
"UserInfo"
>
update mxk_userinfo set
<if
test=
"password != null"
>
password
=
#{password},
decipherable
=
#{decipherable},
</if>
passwordsettype = 0,
passwordlastsettime
=
current_timestamp
<if
test=
"password != null"
>
password
=
#{password},
decipherable
=
#{decipherable},
passwordsettype = #{passwordSetType},
</if>
passwordlastsettime
=
current_timestamp
where
id = #{id}
</update>
...
...
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/SafeController.java
浏览文件 @
494b2b01
...
...
@@ -64,7 +64,7 @@ public class SafeController {
@RequestParam
(
"newPassword"
)
String
newPassword
,
@RequestParam
(
"confirmPassword"
)
String
confirmPassword
)
{
if
(
userInfoService
.
changePassword
(
oldPassword
,
newPassword
,
confirmPassword
))
{
if
(
userInfoService
.
changePassword
(
oldPassword
,
newPassword
,
confirmPassword
,
ConstantsPasswordSetType
.
PASSWORD_NORMAL
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
}
else
{
return
new
Message
(
...
...
@@ -82,7 +82,7 @@ public class SafeController {
ModelAndView
modelAndView
=
new
ModelAndView
(
"passwordExpired"
);
if
(
newPassword
==
null
||
newPassword
.
equals
(
""
))
{
}
else
if
(
userInfoService
.
changePassword
(
oldPassword
,
newPassword
,
confirmPassword
)){
}
else
if
(
userInfoService
.
changePassword
(
oldPassword
,
newPassword
,
confirmPassword
,
ConstantsPasswordSetType
.
PASSWORD_NORMAL
)){
WebContext
.
getSession
().
setAttribute
(
WebConstants
.
CURRENT_LOGIN_USER_PASSWORD_SET_TYPE
,
ConstantsPasswordSetType
.
PASSWORD_NORMAL
);
return
WebContext
.
redirect
(
"/index"
);
}
...
...
@@ -103,7 +103,7 @@ public class SafeController {
ModelAndView
modelAndView
=
new
ModelAndView
(
"passwordInitial"
);
if
(
newPassword
==
null
||
newPassword
.
equals
(
""
))
{
}
else
if
(
userInfoService
.
changePassword
(
oldPassword
,
newPassword
,
confirmPassword
)){
}
else
if
(
userInfoService
.
changePassword
(
oldPassword
,
newPassword
,
confirmPassword
,
ConstantsPasswordSetType
.
PASSWORD_NORMAL
)){
WebContext
.
getSession
().
setAttribute
(
WebConstants
.
CURRENT_LOGIN_USER_PASSWORD_SET_TYPE
,
ConstantsPasswordSetType
.
PASSWORD_NORMAL
);
return
WebContext
.
redirect
(
"/index"
);
}
...
...
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/UserInfoController.java
浏览文件 @
494b2b01
...
...
@@ -27,6 +27,7 @@ import javax.validation.Valid;
import
org.apache.mybatis.jpa.persistence.JpaPageResults
;
import
org.maxkey.constants.ConstantsOperateMessage
;
import
org.maxkey.constants.ConstantsPasswordSetType
;
import
org.maxkey.crypto.ReciprocalUtils
;
import
org.maxkey.entity.ExcelImport
;
import
org.maxkey.entity.UserInfo
;
...
...
@@ -264,6 +265,7 @@ public class UserInfoController {
@RequestMapping
(
value
=
"/changePassword"
)
public
Message
changePassword
(
@ModelAttribute
(
"userInfo"
)
UserInfo
userInfo
)
{
_logger
.
debug
(
userInfo
.
getId
());
userInfo
.
setPasswordSetType
(
ConstantsPasswordSetType
.
PASSWORD_NORMAL
);
if
(
userInfoService
.
changePassword
(
userInfo
,
true
))
{
return
new
Message
(
WebContext
.
getI18nValue
(
ConstantsOperateMessage
.
UPDATE_SUCCESS
),
MessageType
.
success
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录