From e0eaa9df6c3f26bdf6b12102121e39c2b8ac1084 Mon Sep 17 00:00:00 2001 From: Yeaeun411 Date: Sun, 14 Jan 2024 00:43:35 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=9B=B9=EB=A9=94=EC=9D=BC=20=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=EC=8B=9C=20=EC=9D=B4=EB=A6=84=EB=8F=84=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=EB=90=98=EB=8F=84=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/umc/StudyFlexBE/controller/MemberController.java | 1 + .../com/umc/StudyFlexBE/dto/request/SendAuthCodeDto.java | 4 ++++ .../java/com/umc/StudyFlexBE/service/MemberService.java | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/src/main/java/com/umc/StudyFlexBE/controller/MemberController.java b/src/main/java/com/umc/StudyFlexBE/controller/MemberController.java index fcfe685..9d49b59 100644 --- a/src/main/java/com/umc/StudyFlexBE/controller/MemberController.java +++ b/src/main/java/com/umc/StudyFlexBE/controller/MemberController.java @@ -113,6 +113,7 @@ public BaseResponse senAuthCode(@RequestBody SendAuthCodeDto sendAuthCodeDto) if (result.get("success").equals(false)) { return new BaseResponse<>(BaseResponseStatus.WEB_MAIL_CODE_FAILED); } + memberService.saveName(sendAuthCodeDto.getName()); return new BaseResponse(BaseResponseStatus.SUCCESS, "인증 코드 발송 완료."); } catch (Exception e) { return new BaseResponse<>(BaseResponseStatus.SEND_EMAIL_FAILED); diff --git a/src/main/java/com/umc/StudyFlexBE/dto/request/SendAuthCodeDto.java b/src/main/java/com/umc/StudyFlexBE/dto/request/SendAuthCodeDto.java index 6d0b794..ec7a433 100644 --- a/src/main/java/com/umc/StudyFlexBE/dto/request/SendAuthCodeDto.java +++ b/src/main/java/com/umc/StudyFlexBE/dto/request/SendAuthCodeDto.java @@ -15,6 +15,10 @@ public class SendAuthCodeDto { @NotNull private String email; + @JsonProperty + @NotNull + private String name; + @JsonProperty @NotNull private String univName; diff --git a/src/main/java/com/umc/StudyFlexBE/service/MemberService.java b/src/main/java/com/umc/StudyFlexBE/service/MemberService.java index 4beb983..5024673 100644 --- a/src/main/java/com/umc/StudyFlexBE/service/MemberService.java +++ b/src/main/java/com/umc/StudyFlexBE/service/MemberService.java @@ -245,4 +245,12 @@ public void changeEmail(String email, String newEmail) { memberRepository.save(member); } + + public void saveName(String name) { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + String email = authentication.getName(); + Member member = memberRepository.findByEmail(email); + member.setName(name); + memberRepository.save(member); + } } \ No newline at end of file