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