Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
2bc01c91
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 3 年多
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2bc01c91
编写于
5月 11, 2020
作者:
W
wenyann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改密码
上级
c76a0ba9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
30 deletion
+28
-30
backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.java
...in/java/io/metersphere/base/mapper/ext/ExtUserMapper.java
+1
-1
backend/src/main/java/io/metersphere/controller/UserController.java
...c/main/java/io/metersphere/controller/UserController.java
+5
-5
backend/src/main/java/io/metersphere/controller/request/member/EditPassWordRequest.java
...sphere/controller/request/member/EditPassWordRequest.java
+9
-0
backend/src/main/java/io/metersphere/dto/UserPassDTO.java
backend/src/main/java/io/metersphere/dto/UserPassDTO.java
+0
-10
backend/src/main/java/io/metersphere/service/UserService.java
...end/src/main/java/io/metersphere/service/UserService.java
+13
-14
未找到文件。
backend/src/main/java/io/metersphere/base/mapper/ext/ExtUserMapper.java
浏览文件 @
2bc01c91
...
...
@@ -8,5 +8,5 @@ import java.util.List;
public
interface
ExtUserMapper
{
List
<
User
>
getUserList
(
@Param
(
"userRequest"
)
UserRequest
request
);
int
updatePassword
(
@Param
(
"User"
)
User
record
);
int
updatePassword
(
User
record
);
}
backend/src/main/java/io/metersphere/controller/UserController.java
浏览文件 @
2bc01c91
...
...
@@ -10,10 +10,10 @@ import io.metersphere.commons.utils.Pager;
import
io.metersphere.controller.request.UserRequest
;
import
io.metersphere.controller.request.member.AddMemberRequest
;
import
io.metersphere.controller.request.member.QueryMemberRequest
;
import
io.metersphere.controller.request.member.EditPassWordRequest
;
import
io.metersphere.controller.request.organization.AddOrgMemberRequest
;
import
io.metersphere.controller.request.organization.QueryOrgMemberRequest
;
import
io.metersphere.dto.UserDTO
;
import
io.metersphere.dto.UserPassDTO
;
import
io.metersphere.service.OrganizationService
;
import
io.metersphere.service.UserService
;
import
io.metersphere.service.WorkspaceService
;
...
...
@@ -246,13 +246,13 @@ public class UserController {
* 修改当前用户密码
* */
@PostMapping
(
"/update/password"
)
public
int
updateCurrentUserPassword
(
@RequestBody
UserPassDTO
UserPassDTO
)
{
return
userService
.
update
Password
(
UserPassDTO
);
public
int
updateCurrentUserPassword
(
@RequestBody
EditPassWordRequest
request
)
{
return
userService
.
update
CurrentUserPassword
(
request
);
}
/*管理员修改用户密码*/
@PostMapping
(
"/special/password"
)
public
int
updateUserPassword
(
@RequestBody
UserPassDTO
UserPassDTO
)
{
return
userService
.
updateUserPassword
(
UserPassDTO
);
public
int
updateUserPassword
(
@RequestBody
EditPassWordRequest
request
)
{
return
userService
.
updateUserPassword
(
request
);
}
}
backend/src/main/java/io/metersphere/controller/request/member/EditPassWordRequest.java
0 → 100644
浏览文件 @
2bc01c91
package
io.metersphere.controller.request.member
;
import
lombok.Data
;
@Data
public
class
EditPassWordRequest
{
private
String
password
;
private
String
newpassword
;
private
String
id
;
}
backend/src/main/java/io/metersphere/dto/UserPassDTO.java
已删除
100644 → 0
浏览文件 @
c76a0ba9
package
io.metersphere.dto
;
import
lombok.Data
;
@Data
public
class
UserPassDTO
{
private
String
password
;
private
String
newpassword
;
private
String
id
;
}
backend/src/main/java/io/metersphere/service/UserService.java
浏览文件 @
2bc01c91
...
...
@@ -8,11 +8,11 @@ import io.metersphere.commons.exception.MSException;
import
io.metersphere.commons.utils.CodingUtil
;
import
io.metersphere.controller.request.UserRequest
;
import
io.metersphere.controller.request.member.AddMemberRequest
;
import
io.metersphere.controller.request.member.EditPassWordRequest
;
import
io.metersphere.controller.request.member.QueryMemberRequest
;
import
io.metersphere.controller.request.organization.AddOrgMemberRequest
;
import
io.metersphere.controller.request.organization.QueryOrgMemberRequest
;
import
io.metersphere.dto.UserDTO
;
import
io.metersphere.dto.UserPassDTO
;
import
io.metersphere.i18n.Translator
;
import
io.metersphere.user.SessionUser
;
import
io.metersphere.user.SessionUtils
;
...
...
@@ -259,12 +259,12 @@ public class UserService {
}
/*修改当前用户用户密码*/
private
User
getUserPassDTO
(
UserPassDTO
UserPassDTO
)
{
private
User
updateCurrentUserPwd
(
EditPassWordRequest
request
)
{
if
(
SessionUtils
.
getUser
()
!=
null
)
{
User
user
=
userMapper
.
selectByPrimaryKey
(
SessionUtils
.
getUser
().
getId
());
String
pwd
=
user
.
getPassword
();
String
prepwd
=
CodingUtil
.
md5
(
UserPassDTO
.
getPassword
(),
"utf-8"
);
String
newped
=
UserPassDTO
.
getNewpassword
();
String
prepwd
=
CodingUtil
.
md5
(
request
.
getPassword
(),
"utf-8"
);
String
newped
=
request
.
getNewpassword
();
if
(
StringUtils
.
isNotBlank
(
prepwd
))
{
if
(
prepwd
.
trim
().
equals
(
pwd
.
trim
()))
{
user
.
setPassword
(
CodingUtil
.
md5
(
newped
));
...
...
@@ -277,22 +277,21 @@ public class UserService {
return
null
;
}
public
int
update
Password
(
UserPassDTO
UserPassDTO
)
{
User
user
=
getUserPassDTO
(
UserPassDTO
);
return
u
serMapper
.
updatePassword
(
user
);
public
int
update
CurrentUserPassword
(
EditPassWordRequest
request
)
{
User
user
=
updateCurrentUserPwd
(
request
);
return
extU
serMapper
.
updatePassword
(
user
);
}
/*管理员修改用户密码*/
private
User
getUserDTO
(
UserPassDTO
UserPassDTO
){
User
user
=
userMapper
.
selectByPrimaryKey
(
UserPassDTO
.
getId
());
String
newped
=
UserPassDTO
.
getNewpassword
();
private
User
updateUserPwd
(
EditPassWordRequest
request
){
User
user
=
userMapper
.
selectByPrimaryKey
(
request
.
getId
());
String
newped
=
request
.
getNewpassword
();
user
.
setPassword
(
CodingUtil
.
md5
(
newped
));
user
.
setUpdateTime
(
System
.
currentTimeMillis
());
return
user
;
}
public
int
updateUserPassword
(
UserPassDTO
UserPassDTO
){
User
user
=
getUserDTO
(
UserPassDTO
);
int
i
=
userMapper
.
updatePassword
(
user
);
return
i
;
public
int
updateUserPassword
(
EditPassWordRequest
request
){
User
user
=
updateUserPwd
(
request
);
return
extUserMapper
.
updatePassword
(
user
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录