From a3e44d6aeef186d8726bd963b9256e8f60ff30b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8C=80=ED=98=84?= Date: Sun, 29 Oct 2023 19:25:14 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Oauth=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=ED=83=88=ED=87=B4=20=EC=97=AC=EB=B6=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/service/MemberServiceImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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);