Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public ResponseEntity<LoginStatusResponse> checkLoginStatus(HttpServletRequest r
.body(new LoginStatusResponse(false, false, "사용자는 로그인 상태가 아닙니다."));
}

boolean hasNickname = authService.hasNickname();
boolean hasNickname = authService.hasNickname(null);
String message = hasNickname ? "사용자는 완벽하게 회원가입 후 로그인된 상태입니다." :
"닉네임이 없는 상태로 회원가입이 완료되었습니다. 닉네임 입력이 필요합니다.";

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/yerong/wedle/oauth/service/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public LoginResponse login(MemberRequest memberRequest){
}
redisTemplate.opsForValue().set("RT:" + member.getSocialId(), tokenResponse.getRefreshToken(), tokenResponse.getRefreshTokenExpiresIn(), TimeUnit.MILLISECONDS);

return new LoginResponse(tokenResponse.getAccessToken(), tokenResponse.getRefreshToken(), member.isExistingMember(), hasNickname());
return new LoginResponse(tokenResponse.getAccessToken(), tokenResponse.getRefreshToken(), member.isExistingMember(), hasNickname(member.getSocialId()));
}
@Transactional
public TokenResponse refreshAccessToken(String refreshTokenValue){
Expand Down Expand Up @@ -114,8 +114,9 @@ public boolean isLoggedIn() {
return socialId != null && memberRepository.findBySocialId(socialId).isPresent();
}

public boolean hasNickname() {
String socialId = SecurityContextHolder.getContext().getAuthentication().getName();
@Transactional
public boolean hasNickname(String socialId) {
if (socialId == null) socialId = SecurityContextHolder.getContext().getAuthentication().getName();

Member member = memberRepository.findBySocialId(socialId).orElse(null);
return member.getNickname() != null;
Expand Down
Loading