From 914337ecf8948df35dafaf5e914843ba926b6edb Mon Sep 17 00:00:00 2001 From: chamcham0707 Date: Mon, 10 Jun 2024 12:10:08 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=9D=B4?= =?UTF-8?q?=EB=A9=94=EC=9D=BC=20=EC=88=98=EC=A0=95=20=EB=AA=BB=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD,=20=EA=B0=99=EC=9D=80?= =?UTF-8?q?=20=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=EB=A1=9C=20=EB=B0=94?= =?UTF-8?q?=EA=BE=B8=EC=A7=80=20=EB=AA=BB=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/sparta/oneandzerobest/auth/entity/User.java | 1 - .../profile/controller/ProfileController.java | 2 +- .../oneandzerobest/profile/dto/ProfileRequestDto.java | 1 - .../oneandzerobest/profile/service/ProfileService.java | 9 +++++---- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/sparta/oneandzerobest/auth/entity/User.java b/src/main/java/com/sparta/oneandzerobest/auth/entity/User.java index a3a09c4..19276cf 100644 --- a/src/main/java/com/sparta/oneandzerobest/auth/entity/User.java +++ b/src/main/java/com/sparta/oneandzerobest/auth/entity/User.java @@ -86,7 +86,6 @@ public void setProfileImage(Image image) { public void update(ProfileRequestDto requestDto) { this.name = requestDto.getName(); - this.email = requestDto.getEmail(); this.introduction = requestDto.getIntroduction(); } diff --git a/src/main/java/com/sparta/oneandzerobest/profile/controller/ProfileController.java b/src/main/java/com/sparta/oneandzerobest/profile/controller/ProfileController.java index 88530a0..02eb5b4 100644 --- a/src/main/java/com/sparta/oneandzerobest/profile/controller/ProfileController.java +++ b/src/main/java/com/sparta/oneandzerobest/profile/controller/ProfileController.java @@ -10,7 +10,7 @@ import org.springframework.web.multipart.MultipartFile; @RestController -@RequestMapping("/profile") +@RequestMapping("api/profile") @RequiredArgsConstructor public class ProfileController { diff --git a/src/main/java/com/sparta/oneandzerobest/profile/dto/ProfileRequestDto.java b/src/main/java/com/sparta/oneandzerobest/profile/dto/ProfileRequestDto.java index a52a5d5..dbfffa7 100644 --- a/src/main/java/com/sparta/oneandzerobest/profile/dto/ProfileRequestDto.java +++ b/src/main/java/com/sparta/oneandzerobest/profile/dto/ProfileRequestDto.java @@ -5,7 +5,6 @@ @Getter public class ProfileRequestDto { private String name; - private String email; private String introduction; private String password; private String newPassword; diff --git a/src/main/java/com/sparta/oneandzerobest/profile/service/ProfileService.java b/src/main/java/com/sparta/oneandzerobest/profile/service/ProfileService.java index 7a056a2..336026c 100644 --- a/src/main/java/com/sparta/oneandzerobest/profile/service/ProfileService.java +++ b/src/main/java/com/sparta/oneandzerobest/profile/service/ProfileService.java @@ -45,7 +45,7 @@ public ProfileResponseDto editProfile(Long id, ProfileRequestDto requestDto) { () -> new NotFoundUserException() ); - user.update(requestDto); // 이메일, 이름, 한줄소개 수정 + user.update(requestDto); // 이름, 한줄소개 수정 if (requestDto.getPassword() != null && !requestDto.getPassword().isEmpty()) { // 비밀번호가 입력되어 있을때만 비밀번호 검사 시작 if (passwordEncoder.matches(requestDto.getPassword(), user.getPassword())) { // DB에 저장된 비밀번호와 일치하지 않는지 검사 @@ -67,10 +67,11 @@ public ProfileResponseDto editProfile(Long id, ProfileRequestDto requestDto) { */ private void validationPassword(ProfileRequestDto requestDto, String userPassword) { if (!requestDto.getNewPassword().matches("^(?=.*[a-zA-Z])(?=.*\\d)(?=.*[!@#$%^&*])[a-zA-Z\\d!@#$%^&*]{10,}$")) { // 비밀번호를 올바른 형식으로 바꾸려는 검사 - if (passwordEncoder.matches(requestDto.getNewPassword(), userPassword)) { // 이전과 같은 비밀번호로 수정하는지 검사 - throw new UnacceptablePasswordException(); - } throw new PasswordPatternException(); } + + if (passwordEncoder.matches(requestDto.getNewPassword(), userPassword)) { // 이전과 같은 비밀번호로 수정하는지 검사 + throw new UnacceptablePasswordException(); + } } }