diff --git a/backend/core/src/main/java/com/rollthedice/backend/domain/member/entity/Member.java b/backend/core/src/main/java/com/rollthedice/backend/domain/member/entity/Member.java index f25a7332..d75aa018 100644 --- a/backend/core/src/main/java/com/rollthedice/backend/domain/member/entity/Member.java +++ b/backend/core/src/main/java/com/rollthedice/backend/domain/member/entity/Member.java @@ -41,7 +41,8 @@ public void updateRefreshToken(String updateRefreshToken) { this.refreshToken = updateRefreshToken; } - public void updateNickname(String nickname) { + public void signUp(String nickname) { this.nickname = nickname; + this.role = Role.USER; } } diff --git a/backend/core/src/main/java/com/rollthedice/backend/domain/member/service/MemberService.java b/backend/core/src/main/java/com/rollthedice/backend/domain/member/service/MemberService.java index 23233ae1..07f36173 100644 --- a/backend/core/src/main/java/com/rollthedice/backend/domain/member/service/MemberService.java +++ b/backend/core/src/main/java/com/rollthedice/backend/domain/member/service/MemberService.java @@ -15,6 +15,6 @@ public class MemberService { @Transactional public void signUp(SignUpDto dto) { Member member = authService.getMember(); - member.updateNickname(dto.getNickname()); + member.signUp(dto.getNickname()); } } diff --git a/backend/core/src/main/java/com/rollthedice/backend/global/jwt/filter/JwtAuthenticationProcessingFilter.java b/backend/core/src/main/java/com/rollthedice/backend/global/jwt/filter/JwtAuthenticationProcessingFilter.java index 1f52c8d6..690fdbb4 100644 --- a/backend/core/src/main/java/com/rollthedice/backend/global/jwt/filter/JwtAuthenticationProcessingFilter.java +++ b/backend/core/src/main/java/com/rollthedice/backend/global/jwt/filter/JwtAuthenticationProcessingFilter.java @@ -78,9 +78,14 @@ private void checkAccessTokenAndAuthentication(HttpServletRequest request, HttpS } public void saveAuthentication(Member member) { + String password = member.getPassword(); + if (password == null) { + password = PasswordUtil.generateRandomPassword(); + } + UserDetails userDetails = User.builder() .username(member.getEmail()) - .password(PasswordUtil.generateRandomPassword()) + .password(password) .roles(member.getRole().name()) .build();