Skip to content

Commit

Permalink
[fix] 로그인 시 초기 유저, 기존 유저 구분 boolean 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryeolee committed Oct 29, 2023
1 parent 19f40ba commit fee7553
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .jpb/jpb-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaPluginProjectSettings">
<option name="entityNameTemplate" />
<option name="isLombokBuilder" value="true" />
<option name="isLombokAllArgsConstructor" value="true" />
<option name="isLombokNoArgsConstructor" value="true" />
<option name="scaffoldingLanguage" />
</component>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ public class TokenResponseDto {
private String accessToken;

private String refreshToken;

private boolean early;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class AuthService{
public UserRepository userRepository;

private final WebClient webClient;
private boolean early = false;

@Autowired
public AuthService(WebClient webClient, UserRepository userRepository, JwtTokenProvider jwtTokenProvider, RedisTemplate<String, String> redisTemplate) {
Expand Down Expand Up @@ -57,6 +58,7 @@ public TokenResponseDto googleLogin(String accessToken) {
.role("USER")
.profileImage(userInfo.getPicture())
.build();
early = true;

userRepository.save(user);
}
Expand All @@ -69,6 +71,7 @@ public TokenResponseDto googleLogin(String accessToken) {
TokenResponseDto tokenResponseDto = TokenResponseDto.builder()
.message("OK")
.code(200)
.early(early)
.accessToken(jwtTokenProvider.createAccessToken(
userLoginData.get().getId(),
String.valueOf(userLoginData.get().getRole())))
Expand Down Expand Up @@ -103,6 +106,8 @@ public TokenResponseDto kakaoLogin(String accessToken) {
.profileImage(userInfo.getKakao_account().getProfile().getProfile_image_url())
.build();

early = true;

userRepository.save(user);
}

Expand All @@ -114,6 +119,7 @@ public TokenResponseDto kakaoLogin(String accessToken) {
TokenResponseDto tokenResponseDto = TokenResponseDto.builder()
.message("OK")
.code(200)
.early(early)
.accessToken(jwtTokenProvider.createAccessToken(
userLoginData.get().getId(),
String.valueOf(userLoginData.get().getRole())))
Expand Down

0 comments on commit fee7553

Please sign in to comment.