Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 회원가입시 인증회원으로 초기화 되는 오류 수정 #75

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading