diff --git a/src/main/java/com/suite/suite_user_service/member/service/MemberServiceImpl.java b/src/main/java/com/suite/suite_user_service/member/service/MemberServiceImpl.java index 9d2a0a4..4e52517 100644 --- a/src/main/java/com/suite/suite_user_service/member/service/MemberServiceImpl.java +++ b/src/main/java/com/suite/suite_user_service/member/service/MemberServiceImpl.java @@ -82,14 +82,14 @@ else if(member.getAccountStatus().equals(AccountStatus.DISABLED.getStatus())) public Message getOauthSuiteToken(String accessToken, String userAgent, PasswordEncoder passwordEncoder) { ReqSignInMemberDto reqSignInMemberDto = googleAuth.getGoogleMemberInfo(accessToken); - Optional token = memberRepository.findByEmail(reqSignInMemberDto.getEmail()).map(member -> verifyOauthAccount(reqSignInMemberDto, userAgent, passwordEncoder)); + Optional token = memberRepository.findByEmail(reqSignInMemberDto.getEmail()).map(member -> verifyOauthAccount(reqSignInMemberDto, passwordEncoder)); return token.map(suiteToken -> new Message(StatusCode.OK, suiteToken)).orElseGet(() -> new Message(StatusCode.CREATED, reqSignInMemberDto)); } public Message getAppleOauthSuiteToken(String accessToken, String userAgent, PasswordEncoder passwordEncoder) { ReqSignInMemberDto reqSignInMemberDto = appleAuth.getAppleMemberInfo(accessToken); - Optional token = memberRepository.findByEmail(reqSignInMemberDto.getEmail()).map(member -> verifyOauthAccount(reqSignInMemberDto, userAgent, passwordEncoder)); + Optional token = memberRepository.findByEmail(reqSignInMemberDto.getEmail()).map(member -> verifyOauthAccount(reqSignInMemberDto, passwordEncoder)); return token.map(suiteToken -> new Message(StatusCode.OK, suiteToken)).orElseGet(() -> new Message(StatusCode.CREATED, reqSignInMemberDto)); } @@ -191,11 +191,15 @@ public void lookupPassordByPhoneNumber(String email, String newPassword) { member.updatePassword(newPassword); } - private Token verifyOauthAccount(ReqSignInMemberDto reqSignInMemberDto, String userAgent, PasswordEncoder passwordEncoder) { + private Token verifyOauthAccount(ReqSignInMemberDto reqSignInMemberDto, PasswordEncoder passwordEncoder) { Member member = memberRepository.findByEmail(reqSignInMemberDto.getEmail()).orElseThrow(() -> new CustomException(StatusCode.USERNAME_NOT_FOUND)); if(!passwordEncoder.matches(reqSignInMemberDto.getPassword(), member.getPassword())) throw new CustomException(StatusCode.REGISTERED_EMAIL); + else if(member.getAccountStatus().equals(AccountStatus.DORMANT.getStatus())) + throw new CustomException(StatusCode.DORMANT_ACCOUNT); + else if(member.getAccountStatus().equals(AccountStatus.DISABLED.getStatus())) + throw new CustomException(StatusCode.DISABLED_ACCOUNT); Token token = jwtCreator.createToken(member);