Skip to content
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
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ services:
everyonewaiter-api:
container_name: everyonewaiter-api
build: .
image: everyonewaiter-api:1.0.6
image: everyonewaiter-api:1.0.7
ports:
- "8081:8081"
volumes:
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Artifact
appGroup=com.everyonewaiter
appVersion=1.0.6
appVersion=1.0.7

# Plugin
springBoot=3.5.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ interface AccountApiSpecification {
code = ErrorCode.FAILED_SIGN_IN,
exampleName = "이메일 및 λΉ„λ°€λ²ˆν˜Έκ°€ μΌμΉ˜ν•˜μ§€ μ•ŠλŠ” 경우"
),
@ApiErrorResponse(
code = ErrorCode.NOT_COMPLETE_EMAIL_VERIFICATION,
exampleName = "이메일 인증이 μ™„λ£Œλ˜μ§€ μ•Šμ€ 경우"
),
}
)
ResponseEntity<SignInToken> signIn(@RequestBody AccountSignInRequest signInRequest);
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/everyonewaiter/domain/account/Account.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,14 @@ public void authorize(AccountPermission permission) {
}

public void signIn(AccountSignInRequest signInRequest, PasswordEncoder passwordEncoder) {
if (isActive() && passwordEncoder.matches(signInRequest.password(), password)) {
boolean isMatched = passwordEncoder.matches(signInRequest.password(), password);
if (isActive() && isMatched) {
this.lastSignIn = Instant.now();
return;
}

if (isInactive() && isMatched) {
throw new NotCompleteEmailVerificationException();
} else {
throw new FailedSignInException();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.everyonewaiter.domain.account;

import com.everyonewaiter.domain.shared.BusinessException;
import com.everyonewaiter.domain.shared.ErrorCode;

public class NotCompleteEmailVerificationException extends BusinessException {

public NotCompleteEmailVerificationException() {
super(ErrorCode.NOT_COMPLETE_EMAIL_VERIFICATION);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public enum ErrorCode {
EXCEED_MAXIMUM_VERIFICATION_PHONE_NUMBER(
BAD_REQUEST, "μ˜€λŠ˜μ€ 더 이상 νœ΄λŒ€ν° 번호 인증 μš”μ²­μ„ ν•  수 μ—†μ–΄μš”. 내일 λ‹€μ‹œ μ‹œλ„ν•΄ μ£Όμ„Έμš”."),
EXPIRED_VERIFICATION_PHONE_NUMBER(BAD_REQUEST, "νœ΄λŒ€ν° 번호 인증이 λ§Œλ£Œλ˜μ—ˆμ–΄μš”. νœ΄λŒ€ν° 번호 인증을 λ‹€μ‹œ μ§„ν–‰ν•΄ μ£Όμ„Έμš”."),
NOT_COMPLETE_EMAIL_VERIFICATION(BAD_REQUEST, "이메일 인증이 μ™„λ£Œλ˜μ§€ μ•Šμ•˜μ–΄μš”. 이메일 인증을 μ§„ν–‰ν•΄ μ£Όμ„Έμš”."),
ALREADY_VERIFIED_EMAIL(BAD_REQUEST, "이미 이메일 인증이 μ™„λ£Œλœ κ³„μ •μ΄μ—μš”."),
ALREADY_VERIFIED_PHONE_NUMBER(BAD_REQUEST, "이미 νœ΄λŒ€ν° 번호 인증이 μ™„λ£Œλ˜μ—ˆμ–΄μš”. λ‹€μŒ 절차λ₯Ό μ§„ν–‰ν•΄ μ£Όμ„Έμš”."),
UNMATCHED_VERIFICATION_CODE(BAD_REQUEST, "인증 λ²ˆν˜Έκ°€ μΌμΉ˜ν•˜μ§€ μ•Šμ•„μš”. μž…λ ₯ν•˜μ‹  인증 번호λ₯Ό 확인해 μ£Όμ„Έμš”."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ void signInFail() {
Account account = Account.create(createAccountCreateRequest(), passwordEncoder);

assertThatThrownBy(() -> account.signIn(createAccountSignInRequest(), passwordEncoder))
.isInstanceOf(NotCompleteEmailVerificationException.class);
assertThatThrownBy(() -> account.signIn(createAccountSignInRequest("invalid"), passwordEncoder))
.isInstanceOf(FailedSignInException.class);

account.activate();
Expand Down