Skip to content

Commit

Permalink
Merge pull request #43 from StudyFlexUMC5th/yeeun2
Browse files Browse the repository at this point in the history
Fix: 웹메일 인증시 이름도 저장되도록
  • Loading branch information
Yeeun411 authored Jan 13, 2024
2 parents f058a3d + e0eaa9d commit 2cb1984
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>(BaseResponseStatus.SUCCESS, "인증 코드 발송 완료.");
} catch (Exception e) {
return new BaseResponse<>(BaseResponseStatus.SEND_EMAIL_FAILED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public class SendAuthCodeDto {
@NotNull
private String email;

@JsonProperty
@NotNull
private String name;

@JsonProperty
@NotNull
private String univName;
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/umc/StudyFlexBE/service/MemberService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 2cb1984

Please sign in to comment.