diff --git a/api/src/main/java/com/org/gunbbang/service/NativeAuthService.java b/api/src/main/java/com/org/gunbbang/service/NativeAuthService.java index 57452c84..6e210dd1 100644 --- a/api/src/main/java/com/org/gunbbang/service/NativeAuthService.java +++ b/api/src/main/java/com/org/gunbbang/service/NativeAuthService.java @@ -28,8 +28,22 @@ public NativeAuthService( } @Override - public SignedUpMemberVO saveMemberOrLogin(String platformToken, MemberSignUpRequestDTO request) - throws Exception { + public SignedUpMemberVO saveMemberOrLogin(String platformToken, MemberSignUpRequestDTO request) { + if (isNullOrBlank(request.getPassword()) + || isNullOrBlank(request.getNickname()) + || isNullOrBlank(request.getEmail())) { + log.warn( + "자체로그인 시 필요한 요청 값이 오지 않음. pwd: {} nickname: {} email: {}", + request.getPassword(), + request.getNickname(), + request.getEmail()); + throw new BadRequestException( + ErrorType.NO_REQUEST_PARAMETER_EXCEPTION, + ErrorType.NO_REQUEST_PARAMETER_EXCEPTION.getMessage() + + " email 필드 누락됨: " + + request.getEmail()); + } + if (memberRepository.findByEmail(request.getEmail()).isPresent()) { throw new BadRequestException(ErrorType.ALREADY_EXIST_EMAIL_EXCEPTION); } @@ -41,4 +55,8 @@ public SignedUpMemberVO saveMemberOrLogin(String platformToken, MemberSignUpRequ Member savedMember = saveUser(request, request.getEmail()); return SignedUpMemberVO.of(savedMember, null, AuthType.SIGN_UP); } + + private boolean isNullOrBlank(String input) { + return input == null || input.isBlank(); + } }