Skip to content

Commit

Permalink
Merge pull request #59 from software-project-yu/58-hotfixconfirm-rese…
Browse files Browse the repository at this point in the history
…t-password

🚑hotfix:비밀번호 재설정 오류 수정
  • Loading branch information
pjs1710 authored Nov 27, 2024
2 parents 5dbc7a7 + 5c6b2e8 commit dce4c7e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
@NoArgsConstructor
public class VerificationCodeConfirmDTO {
@NotNull

private String code;
private String newPassword;
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ public ResponseEntity<?> resetPassword(@RequestBody @Valid VerificationCodeReque

//* 비밀번호 재설정 확인
@PostMapping("/confirm-reset-password")
public ResponseEntity<?> confirmResetPassword(@RequestParam("code") String code, @RequestBody @Valid VerificationCodeConfirmDTO confirmDTO) {
String result = signupService.validatePasswordResetCode(code);
public ResponseEntity<?> confirmResetPassword(@RequestBody @Valid VerificationCodeConfirmDTO confirmDTO) {
String result = signupService.validatePasswordResetCode(confirmDTO.getCode());
if (!result.equals("valid")) {
return ResponseEntity.badRequest().body(ErrorCode.PASSWORD_RESET_INVALID.getMessage());
}
try {
// 비밀번호 재설정
signupService.resetPassword(code, confirmDTO.getNewPassword());
signupService.resetPassword(confirmDTO.getCode(), confirmDTO.getNewPassword());
return ResponseEntity.ok(SuccessCode.SUCCESS_PASSWORD_RESET.getMessage());
} catch (CustomException e) {
return ResponseEntity.badRequest().body(ErrorCode.PASSWORD_RESET_INVALID.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public String validatePasswordResetCode(String code) {
throw new CustomException(ErrorCode.PASSWORD_RESET_INVALID);
}

return SuccessCode.SUCCESS_PASSWORD_RESET.getMessage();
return "valid";
}

@Override
Expand Down

0 comments on commit dce4c7e

Please sign in to comment.