Skip to content

Commit

Permalink
Merge pull request #59 from Capstone-Richam/feature/39-mail
Browse files Browse the repository at this point in the history
[fix]
  • Loading branch information
qogustj authored Dec 10, 2023
2 parents 6ed5bf0 + 50da388 commit 2e51170
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ public void register(MemberRegisterRequestDto resource) {

@Transactional
public SignInResponseDto signIn (String account, String password){
Member member = memberRepository.findByAccount(account).orElseThrow(() -> new InvalidEmailException("회원정보가 존재하지 않습니다."));
Member member = memberRepository.findByAccount(account).orElseThrow(() -> new BusinessException
(NAME_ERROR));
if (!passwordEncoder.matches(password, member.getPassword())) {

throw new InvalidPasswordException("잘못된 비밀번호입니다.");
throw new BusinessException(NAME_ERROR);
}
TokenInfo tokenInfo = oAuthService.issueAccessTokenAndRefreshToken(member);
member.updateRefreshToken(tokenInfo.getRefreshToken());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
ErrorCode.NAME_EXISTS_ERROR,
request, response, "닉네임 중복.", "DEFAULT-ERROR-01"
);
}
handleException(response);
}else if(errorMessage.contains("잘못")){setErrorResponse(
HttpStatus.INTERNAL_SERVER_ERROR,
ErrorCode.NAME_ERROR,
request, response, "잘못.", "DEFAULT-ERROR-01"
);}
else{
handleException(response);}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/Nunbody/global/error/ErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public enum ErrorCode {
EMAIL_EXISTS_ERROR(HttpStatus.BAD_REQUEST, "이미 존재하는 이메일입니다."),
ACCOUNT_EXISTS_ERROR(HttpStatus.PRECONDITION_FAILED, "이미 존재하는 아이디입니다."),
NAME_EXISTS_ERROR(HttpStatus.PAYLOAD_TOO_LARGE, "이미 존재하는 닉네임입니다."),
NAME_ERROR(HttpStatus.PAYLOAD_TOO_LARGE, "잘못"),
INVALID_EMAIL_ERROR(HttpStatus.GONE, "존재하지 않는 이메일 정보입니다."),
INVALID_PASSWORD_ERROR(HttpStatus.BAD_REQUEST, "비밀번호를 확인해주세요. 카카오 계정이라면 카카오 로그인으로 시도해주세요."),
INVALID_ACCESS_TOKEN_ERROR(HttpStatus.BAD_REQUEST, "AccessToken 정보를 찾을 수 없습니다."),
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/Nunbody/jwt/ExceptionHandleFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
ErrorCode.NAME_EXISTS_ERROR,
request, response, "닉네임 중복.", "DEFAULT-ERROR-01"
);
}
}else if(errorMessage.contains("잘못")){setErrorResponse(
HttpStatus.INTERNAL_SERVER_ERROR,
ErrorCode.NAME_ERROR,
request, response, "잘못.", "DEFAULT-ERROR-01"
);}
}
}

Expand Down

0 comments on commit 2e51170

Please sign in to comment.