Skip to content

Commit

Permalink
Merge pull request #75 from IT-Cotato/fix/oauth2-member
Browse files Browse the repository at this point in the history
Fix 회원가입시 인증회원으로 초기화 되는 오류 수정
  • Loading branch information
goalSetter09 authored Aug 21, 2024
2 parents bfad56d + 8c91dbf commit 5143094
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Member toEntity(String uniqueId){
.username(username)
.email(email)
.uniqueId(uniqueId)
.memberRole(MemberRole.CERTIFIED_MEMBER.toString())
.memberRole(MemberRole.MEMBER.toString())
.profileImage("default profile img")
.university("uncertified")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,9 @@ public Member updateProfileImage(String profileImage) {
this.profileImage = profileImage;
return this;
}

public Member updateMemberRole(MemberRole memberRole) {
this.memberRole = memberRole;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.cotato.squadus.common.config.RedisConfig;
import com.cotato.squadus.common.config.auth.CustomOAuth2Member;
import com.cotato.squadus.domain.auth.entity.Member;
import com.cotato.squadus.domain.auth.enums.MemberRole;
import com.cotato.squadus.domain.auth.enums.SchoolDomain;
import jakarta.mail.MessagingException;
import jakarta.mail.internet.MimeMessage;
Expand Down Expand Up @@ -99,13 +100,14 @@ public Boolean checkAuthNum(String email, String authNum, @AuthenticationPrincip
// 회원의 university 필드를 업데이트
Member memberByUniqueId = memberService.findMemberByUniqueId(customOauth2Member.getUniqueId());
memberByUniqueId.updateUniversity(universityName);
memberByUniqueId.updateMemberRole(MemberRole.CERTIFIED_MEMBER);
memberService.saveMember(memberByUniqueId);
log.info("사용자 {}의 university 필드가 {}로 업데이트 되었습니다.", memberByUniqueId.getUsername(), universityName);
log.info("사용자 {}의 memberRole 필드가 {}로 업데이트 되었습니다.", memberByUniqueId.getUsername(), MemberRole.CERTIFIED_MEMBER);
}

return isAuthSuccessful;
}

private boolean isValidSchoolEmail(String email) {
if (email == null || !email.contains("@")) {
return false;
Expand Down

0 comments on commit 5143094

Please sign in to comment.