Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE] Email-verification 미인증시 로그인 수정 #90 #93

Merged
merged 1 commit into from
Oct 24, 2023
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 @@ -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
Loading