Skip to content

Commit

Permalink
Adds UpdatePasswordDTO and uses it in updatePassword.
Browse files Browse the repository at this point in the history
Signed-off-by: 自由的世界人 <[email protected]>
  • Loading branch information
Pleasurecruise committed Nov 27, 2024
1 parent 3d456dd commit 48f5bb4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package cn.yiming1234.NottinghamWall.dto;

import lombok.Data;

@Data
public class UpdatePasswordDTO {
private String oldPassword;
private String newPassword;
private String confirmPassword;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import cn.yiming1234.NottinghamWall.dto.AdminDTO;
import cn.yiming1234.NottinghamWall.dto.AdminLoginDTO;
import cn.yiming1234.NottinghamWall.dto.PageQueryDTO;
import cn.yiming1234.NottinghamWall.dto.UpdatePasswordDTO;
import cn.yiming1234.NottinghamWall.entity.Admin;
import cn.yiming1234.NottinghamWall.properties.JwtProperties;
import cn.yiming1234.NottinghamWall.result.PageResult;
Expand Down Expand Up @@ -138,11 +139,9 @@ public Result<Admin> update(@RequestBody AdminDTO adminDTO){
@ApiOperation("修改密码")
public Result<Object> updatePassword(
@RequestHeader("token") String token,
@RequestBody String oldPassword,
@RequestBody String newPassword,
@RequestBody String confirmPassword){
@RequestBody UpdatePasswordDTO updatePasswordDTO){
Integer adminId = getAdminId(token);
adminService.updatePassword(adminId, oldPassword, newPassword, confirmPassword);
adminService.updatePassword(adminId, updatePasswordDTO.getOldPassword(), updatePasswordDTO.getNewPassword(), updatePasswordDTO.getConfirmPassword());
return Result.success();
}
}

0 comments on commit 48f5bb4

Please sign in to comment.