Skip to content

Commit

Permalink
Merge pull request #93 from hook-killer/fix/90-login-verify
Browse files Browse the repository at this point in the history
[ISSUE] Email-verification 미인증시 로그인 수정 #90
  • Loading branch information
donsonioc2010 authored Oct 24, 2023
2 parents 28cc621 + bb3b28f commit d1ceacd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import HookKiller.server.common.exception.BaseErrorCode;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.http.HttpStatus;

import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.HttpStatus.NOT_FOUND;
import static org.springframework.http.HttpStatus.UNAUTHORIZED;

@Getter
@AllArgsConstructor
Expand All @@ -15,7 +15,8 @@ public enum AuthException implements BaseErrorCode {
INVALID_TOKEN_ERROR(UNAUTHORIZED.value(), "Token_403_2", "토큰이 만료되었거나 형식에 맞지않은 토큰입니다."),
TOKEN_NOT_FOUND_ERROR(NOT_FOUND.value(), "Token_404_1", "토큰을 찾을 수 없습니다."),
USER_NOT_FOUND_ERROR(NOT_FOUND.value(), "User_404_1", "유저를 찾을 수 없습니다."),
PASSWORD_INCORRECT_ERROR(NOT_FOUND.value(), "User_404_2", "비밀번호가 다릅니다 다시 입력해 주세요.")
PASSWORD_INCORRECT_ERROR(NOT_FOUND.value(), "User_404_2", "비밀번호가 다릅니다 다시 입력해 주세요."),
STATUS_NOT_VERIFICATION_ERROR(UNAUTHORIZED.value(), "User_404_3", "이메일 인증을 완료해 주세요.")
;

private final Integer statusCode;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package HookKiller.server.auth.exception;

import HookKiller.server.common.exception.BaseException;

public class StatusNotVerificationException extends BaseException {
public static final BaseException EXCEPTION = new StatusNotVerificationException();

private StatusNotVerificationException() {
super(AuthException.STATUS_NOT_VERIFICATION_ERROR);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import HookKiller.server.auth.dto.response.AuthResponse;
import HookKiller.server.auth.dto.response.OAuthResponse;
import HookKiller.server.auth.exception.PasswordIncorrectException;
import HookKiller.server.auth.exception.StatusNotVerificationException;
import HookKiller.server.auth.exception.UserNotFoundException;
import HookKiller.server.auth.helper.OauthHelper;
import HookKiller.server.auth.helper.TokenGenerateHelper;
Expand Down Expand Up @@ -47,7 +48,7 @@ public ResponseEntity<AuthResponse> loginExecute(AuthRequest request) {

if (user.getStatus().equals(Status.NOT_ACTIVE)) {
mailHelper.sendVerificationMail(MailRequest.builder().email(user.getEmail()).verificationToken(user.getVerificationToken()).build());
return ResponseEntity.ok(AuthResponse.builder().build());
throw StatusNotVerificationException.EXCEPTION;
}

AuthResponse res = AuthResponse.builder()
Expand Down

0 comments on commit d1ceacd

Please sign in to comment.