修改密码

This commit is contained in:
wenyann 2020-05-11 15:47:37 +08:00
parent 867225673b
commit 92704173dd
3 changed files with 14 additions and 8 deletions

View File

@ -32,6 +32,7 @@
</if>
</where>
</select>
<!--修改密码-->
<update id="updatePassword" parameterType="io.metersphere.base.domain.User">
update user

View File

@ -9,8 +9,8 @@ import io.metersphere.commons.utils.PageUtils;
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.member.QueryMemberRequest;
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
import io.metersphere.dto.UserDTO;
@ -250,6 +250,7 @@ public class UserController {
public List<User> getBesideOrgMemberList(@PathVariable String orgId) {
return userService.getBesideOrgMemberList(orgId);
}
/*
* 修改当前用户密码
* */
@ -257,6 +258,7 @@ public class UserController {
public int updateCurrentUserPassword(@RequestBody EditPassWordRequest request) {
return userService.updateCurrentUserPassword(request);
}
/*管理员修改用户密码*/
@PostMapping("/special/password")
public int updateUserPassword(@RequestBody EditPassWordRequest request) {

View File

@ -277,6 +277,7 @@ public class UserService {
userMapper.updateByPrimaryKeySelective(newUser);
}
/*修改当前用户用户密码*/
private User updateCurrentUserPwd(EditPassWordRequest request) {
if (SessionUtils.getUser() != null) {
@ -300,6 +301,7 @@ public class UserService {
User user = updateCurrentUserPwd(request);
return extUserMapper.updatePassword(user);
}
/*管理员修改用户密码*/
private User updateUserPwd(EditPassWordRequest request) {
User user = userMapper.selectByPrimaryKey(request.getId());
@ -308,6 +310,7 @@ public class UserService {
user.setUpdateTime(System.currentTimeMillis());
return user;
}
public int updateUserPassword(EditPassWordRequest request) {
User user = updateUserPwd(request);
return extUserMapper.updatePassword(user);