Skip to content

Commit bc18338

Browse files
authored
Merge pull request #206 from DevKor-github/main
[Merge] main to deploy
2 parents f9bb372 + 2d41b4f commit bc18338

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ontime-back/src/main/java/devkor/ontime_back/global/oauth/google/GoogleLoginService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,12 @@ public Authentication handleRegister(OAuthGoogleRequestDto oAuthGoogleRequestDto
112112
User savedUser = userRepository.save(newUser);
113113

114114
String accessToken = jwtTokenProvider.createAccessToken(newUser.getEmail(), newUser.getId());
115-
jwtTokenProvider.sendAccessToken(response, accessToken);
115+
String refreshToken = jwtTokenProvider.createRefreshToken();
116+
117+
jwtTokenProvider.sendAccessAndRefreshToken(response, accessToken, refreshToken);
118+
119+
savedUser.updateRefreshToken(refreshToken);
120+
userRepository.save(savedUser);
116121

117122
Authentication authentication = new UsernamePasswordAuthenticationToken(
118123
savedUser, null, Collections.singletonList(new SimpleGrantedAuthority(savedUser.getRole().name()))
@@ -122,7 +127,7 @@ public Authentication handleRegister(OAuthGoogleRequestDto oAuthGoogleRequestDto
122127
response.setContentType("application/json");
123128
response.setCharacterEncoding("UTF-8");
124129

125-
String msg = savedUser.getRole().name().equals("GUEST") ? "유저의 ROLE이 GUEST이므로 온보딩API를 호출해 온보딩을 진행해야합니다." : "로그인에 성공하였습니다.";
130+
String msg = "회원가입에 성공하였습니다.";
126131
// JSON 응답 생성
127132
String responseBody = String.format(
128133
"{ \"status\": \"success\", \"code\": \"200\", \"message\": \"%s\", \"data\": { " +

0 commit comments

Comments
 (0)