Skip to content

Commit

Permalink
Merge pull request #143 from MADA-UMC/develop
Browse files Browse the repository at this point in the history
fix: 로그인 시 회원탈퇴 여부 체크하면서 발생한 오류 해결
  • Loading branch information
yujiyea authored May 16, 2024
2 parents cc43402 + 8093b98 commit b40c98b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.umc.mada.auth.handler;

import com.umc.mada.auth.handler.jwt.JwtTokenProvider;
import com.umc.mada.exception.NotFoundUserException;
import com.umc.mada.user.domain.CusomtUserDetails;
import com.umc.mada.user.domain.User;
import com.umc.mada.user.repository.UserRepository;
Expand Down Expand Up @@ -33,7 +34,8 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo
String refreshToken = jwtTokenProvider.createRefreshToken(oAuth2User);

//refreshtoken을 DB에 저장해야함
User user = userRepository.findByAuthIdAndAccountExpired(authentication.getName(), false).orElseThrow(()-> new RuntimeException("올바른 유저 ID가 아닙니다."));
// User user = userRepository.findByAuthIdAndAccountExpired(authentication.getName(), false).orElseThrow(()-> new RuntimeException("올바른 유저 ID가 아닙니다."));
User user = userRepository.findByAuthId(oAuth2User.getName()).orElseThrow(()-> new NotFoundUserException("유저를 찾을 수 없습니다."));
user.setRefreshToken(refreshToken);

// tokenResponse(response, accessToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ private OAuth2User process(OAuth2UserRequest userRequest, OAuth2User oAuth2User)

OAuth2Attributes oAuth2Attributes = OAuth2Attributes.of(provider, userNameAttributeName, oAuth2User.getAttributes());

Optional<User> userOptional = userRepository.findByAuthIdAndAccountExpired(oAuth2Attributes.getAuthId(), false);
Optional<User> userOptional = userRepository.findByAuthId(oAuth2Attributes.getAuthId());
// Optional<User> userOptional = userRepository.findByAuthIdAndAccountExpired(oAuth2Attributes.getAuthId(), false);

User user;
boolean newUser=false;
Expand Down

0 comments on commit b40c98b

Please sign in to comment.