From 1b3551e6d7969bec0cbef4594e814c7af140f745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=98=A4=EC=A4=80=EC=98=81?= Date: Mon, 26 Jan 2026 22:19:18 +0900 Subject: [PATCH 01/17] =?UTF-8?q?:sparkles:=20feat:=20Spring=20=EC=84=9C?= =?UTF-8?q?=EB=B2=84=EC=97=90=EC=84=9C=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?= =?UTF-8?q?=EC=A0=84=EC=86=A1=EC=9D=84=20=EC=9C=84=ED=95=9C=20build.gradle?= =?UTF-8?q?=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.gradle b/build.gradle index f352d78..6f7a92b 100644 --- a/build.gradle +++ b/build.gradle @@ -53,6 +53,9 @@ dependencies { //swagger implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.0' implementation 'org.springdoc:springdoc-openapi-starter-webmvc-api:2.8.0' + + //Email + implementation 'org.springframework.boot:spring-boot-starter-mail' } tasks.named('test') { From dcefec32850ab8a2c8298963f9077808420a941e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=98=A4=EC=A4=80=EC=98=81?= Date: Mon, 26 Jan 2026 22:20:06 +0900 Subject: [PATCH 02/17] =?UTF-8?q?:sparkles:=20feat:=20=EC=9D=B4=EB=A9=94?= =?UTF-8?q?=EC=9D=BC=20=EC=9D=B8=EC=A6=9D=EC=BD=94=EB=93=9C=EB=A5=BC=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=ED=95=98=EA=B8=B0=20=EC=9C=84=ED=95=9C=20Red?= =?UTF-8?q?isUtil=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WhereYouAd/global/utils/RedisUtil.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/main/java/com/whereyouad/WhereYouAd/global/utils/RedisUtil.java diff --git a/src/main/java/com/whereyouad/WhereYouAd/global/utils/RedisUtil.java b/src/main/java/com/whereyouad/WhereYouAd/global/utils/RedisUtil.java new file mode 100644 index 0000000..58234e6 --- /dev/null +++ b/src/main/java/com/whereyouad/WhereYouAd/global/utils/RedisUtil.java @@ -0,0 +1,33 @@ +package com.whereyouad.WhereYouAd.global.utils; + +import lombok.RequiredArgsConstructor; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Service; + +import java.time.Duration; + +@Service +@RequiredArgsConstructor +public class RedisUtil { + + private final StringRedisTemplate template; + + //Redis 에 데이터 저장(유효시간 설정) + public void setDataExpire(String key, String value, long duration) { + ValueOperations valueOperations = template.opsForValue(); + Duration expireDuration = Duration.ofSeconds(duration); + valueOperations.set(key, value, expireDuration); + } + + //Redis 에서 데이터 꺼내기(Value 꺼내기) + public String getData(String key) { + ValueOperations valueOperations = template.opsForValue(); + return valueOperations.get(key); + } + + //Redis 에서 데이터 지우기(key 값 기반) + public void deleteData(String key) { + template.delete(key); + } +} From 4de758a0007b84f3f81b85e5b8b2ab5b58b59257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=98=A4=EC=A4=80=EC=98=81?= Date: Mon, 26 Jan 2026 22:20:37 +0900 Subject: [PATCH 03/17] =?UTF-8?q?:sparkles:=20feat:=20=EC=9D=B4=EB=A9=94?= =?UTF-8?q?=EC=9D=BC=20=EC=9D=B8=EC=A6=9D=EA=B4=80=EB=A0=A8=20Request,=20R?= =?UTF-8?q?esponse=20DTO=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/application/dto/request/EmailRequest.java | 11 +++++++++++ .../application/dto/request/EmailVerifyRequest.java | 13 +++++++++++++ .../application/dto/response/EmailSentResponse.java | 8 ++++++++ 3 files changed, 32 insertions(+) create mode 100644 src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailRequest.java create mode 100644 src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailVerifyRequest.java create mode 100644 src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/response/EmailSentResponse.java diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailRequest.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailRequest.java new file mode 100644 index 0000000..a3708f6 --- /dev/null +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailRequest.java @@ -0,0 +1,11 @@ +package com.whereyouad.WhereYouAd.domains.user.application.dto.request; + +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; + +public record EmailRequest( + @NotBlank(message = "이메일은 필수입니다.") + @Email(message = "이메일 형식이 올바르지 않습니다.") + String email +) { +} diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailVerifyRequest.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailVerifyRequest.java new file mode 100644 index 0000000..4bfb4ca --- /dev/null +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailVerifyRequest.java @@ -0,0 +1,13 @@ +package com.whereyouad.WhereYouAd.domains.user.application.dto.request; + +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; + +public record EmailVerifyRequest( + @NotBlank(message = "이메일은 필수입니다.") + @Email(message = "이메일 형식이 올바르지 않습니다.") + String email, + @NotBlank + String authCode +) { +} diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/response/EmailSentResponse.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/response/EmailSentResponse.java new file mode 100644 index 0000000..43e50e5 --- /dev/null +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/response/EmailSentResponse.java @@ -0,0 +1,8 @@ +package com.whereyouad.WhereYouAd.domains.user.application.dto.response; + +public record EmailSentResponse( + String message, //인증코드를 이메일로 전송했습니다. + String email, //전송한 이메일 + long expireIn //만료시간 (500L -> 500초) +) { +} From 11123c302e92c1c493683c880bd60a608643f8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=98=A4=EC=A4=80=EC=98=81?= Date: Mon, 26 Jan 2026 22:21:30 +0900 Subject: [PATCH 04/17] =?UTF-8?q?:sparkles:=20feat:=20=EC=9D=B4=EB=A9=94?= =?UTF-8?q?=EC=9D=BC=20=EC=9D=B8=EC=A6=9D=20=EC=B2=98=EB=A6=AC=ED=95=98?= =?UTF-8?q?=EB=8A=94=20EmailService=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/domain/service/EmailService.java | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 src/main/java/com/whereyouad/WhereYouAd/domains/user/domain/service/EmailService.java diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/domain/service/EmailService.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/domain/service/EmailService.java new file mode 100644 index 0000000..abb31ce --- /dev/null +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/user/domain/service/EmailService.java @@ -0,0 +1,107 @@ +package com.whereyouad.WhereYouAd.domains.user.domain.service; + +import com.whereyouad.WhereYouAd.domains.user.application.dto.response.EmailSentResponse; +import com.whereyouad.WhereYouAd.domains.user.exception.UserSignUpException; +import com.whereyouad.WhereYouAd.domains.user.exception.code.UserErrorCode; +import com.whereyouad.WhereYouAd.domains.user.persistence.repository.UserRepository; +import com.whereyouad.WhereYouAd.global.utils.RedisUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.mail.MailException; +import org.springframework.mail.SimpleMailMessage; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Transactional +@Service +@RequiredArgsConstructor +@Slf4j +public class EmailService { + + private final JavaMailSender emailSender; + private final RedisUtil redisUtil; + private final UserRepository userRepository; + + //application.yml 적용 필요 + @Value("${spring.mail.username}") + private String senderEmail; + + //인증코드 이메일 발송 로직 + public EmailSentResponse sendEmail(String toEmail) { + + if (userRepository.existsByEmail(toEmail)) { //이미 해당 이메일로 생성한 계정이 있으면 + throw new UserSignUpException(UserErrorCode.USER_EMAIL_DUPLICATE); //이메일 중복 예외(회원가입 시 사용했던 예외) + } + + //인증코드 재전송 로직 -> 이미 Redis 에 해당 이메일 인증코드가 있을시 삭제 + String redisKey = "CODE:" + toEmail; + if (redisUtil.getData(redisKey) != null) { + redisUtil.deleteData(redisKey); + } + + String authCode = createCode(); //인증코드 생성 + + if (isTestEmail(toEmail)) { + //테스트용 가짜 이메일은 서버 로그로만 인증코드를 보여주기 + //실제 이메일 발송 X + //존재하지 않는 이메일 주소로 계속 이메일을 보내면 인증코드 전송용 이메일 계정이 스팸처리 될 가능성 존재하여 로그로 남기기 + log.warn("{} 이메일 -> 테스트 or 개발용 가짜 이메일 입니다.", toEmail); + log.warn("[TEST 모드] 실제 발송을 건너뜁니다."); + log.warn("[TEST 모드] 수신자: {}", toEmail); + log.warn("[TEST 모드] 인증코드: {}", authCode); + + } else { //실제 존재하는 이메일이라면 + + try { + //실제 인증 코드가 담긴 이메일 전송 + SimpleMailMessage message = new SimpleMailMessage(); + message.setTo(toEmail); + message.setSubject("whereyouad 회원가입 인증번호"); + message.setText("인증번호: " + authCode); + message.setFrom(senderEmail); + + emailSender.send(message); //만약 실제 존재하는 이메일인데 사용자가 오타를 냈다면 + } catch (MailException e) { //예외 발생 + throw new UserSignUpException(UserErrorCode.USER_EMAIL_NOT_VALID); //통합 응답 처리 예외로 반환 + } + + } + + //Redis에 저장 (Key: "CODE:이메일", Value: "123456", 유효시간: 300초(5분)) + //테스트 계정도 인증은 해야하니 Redis 에 코드가 저장 되어야 함. + //테스트 계정의 인증은 서버 로그를 통해 인증코드를 얻어 입력. + redisUtil.setDataExpire("CODE:" + toEmail, authCode, 60 * 5L); + + return new EmailSentResponse("인증코드를 이메일로 전송했습니다.", toEmail, 300L); + } + + //인증코드 검증 메서드 + public void verifyEmailCode(String email, String inputCode) { + //해당 이메일 값으로 Redis 에서 조회 + String key = "CODE:" + email; + String savedCode = redisUtil.getData(key); + + //만약 인증코드가 없거나 잘못 입력했다면, + if (savedCode == null || !savedCode.equals(inputCode)) { + throw new UserSignUpException(UserErrorCode.USER_EMAIL_AUTH_INVALID); //예외 발생(BAD_REQUEST) + } + + //정상적으로 인증코드를 입력했다면, + //기존 Redis 에 저장된 데이터를 지우고, + redisUtil.deleteData(key); + //"해당 이메일이 정상적으로 인증되었다" 는 값을 다시 Redis 에 저장 -> 이후 회원가입(signup) 내부 로직에서 활용 + redisUtil.setDataExpire("VERIFIED:" + email, "TRUE", 60 * 60L); //1시간 뒤 Expire + } + + //테스트용 이메일은, "test" 로 시작하거나, "example.com" 으로 끝나야 한다. + private boolean isTestEmail(String email) { + return email.startsWith("test") || email.endsWith("example.com"); + } + + //무작위 인증코드 값 생성 + private String createCode() { + return String.valueOf((int)(Math.random() * (900000)) + 100000); + } +} From 5e0259f65dab9f3056d325884b5ed576653ab0ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=98=A4=EC=A4=80=EC=98=81?= Date: Mon, 26 Jan 2026 22:22:12 +0900 Subject: [PATCH 05/17] =?UTF-8?q?:sparkles:=20feat:=20=EC=9D=B4=EB=A9=94?= =?UTF-8?q?=EC=9D=BC=20=EC=9D=B8=EC=A6=9D=20=EA=B4=80=EB=A0=A8=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=EC=B2=98=EB=A6=AC=20=EC=BD=94=EB=93=9C=20UserErrorCod?= =?UTF-8?q?e=EC=97=90=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WhereYouAd/domains/user/exception/code/UserErrorCode.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/exception/code/UserErrorCode.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/exception/code/UserErrorCode.java index 9e591f7..c126d4e 100644 --- a/src/main/java/com/whereyouad/WhereYouAd/domains/user/exception/code/UserErrorCode.java +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/user/exception/code/UserErrorCode.java @@ -9,6 +9,9 @@ @AllArgsConstructor public enum UserErrorCode implements BaseErrorCode { USER_EMAIL_DUPLICATE(HttpStatus.BAD_REQUEST, "USER_400_2", "이미 사용중인 이메일 입니다."), + USER_EMAIL_NOT_VERIFIED(HttpStatus.UNAUTHORIZED, "USER_401_1", "이메일 인증이 진행되지 않았습니다."), + USER_EMAIL_NOT_VALID(HttpStatus.BAD_REQUEST, "USER_400_3", "해당 이메일로 메일 전송에 실패했습니다."), + USER_EMAIL_AUTH_INVALID(HttpStatus.BAD_REQUEST, "USER_400_4", "인증 코드가 올바르지 않습니다.") ; private final HttpStatus httpStatus; From 2b8e818088034e4c9defd19b4557e52155d4041c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=98=A4=EC=A4=80=EC=98=81?= Date: Mon, 26 Jan 2026 22:23:59 +0900 Subject: [PATCH 06/17] =?UTF-8?q?:sparkles:=20feat:=20=EA=B8=B0=EC=A1=B4?= =?UTF-8?q?=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=EB=90=98=EC=96=B4=EC=95=BC=20=EA=B0=80=EC=9E=85=20?= =?UTF-8?q?=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domains/user/domain/service/UserService.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/domain/service/UserService.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/domain/service/UserService.java index 6c3c8d6..c347422 100644 --- a/src/main/java/com/whereyouad/WhereYouAd/domains/user/domain/service/UserService.java +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/user/domain/service/UserService.java @@ -8,6 +8,7 @@ import com.whereyouad.WhereYouAd.domains.user.application.dto.response.SignUpResponse; import com.whereyouad.WhereYouAd.domains.user.persistence.entity.User; import com.whereyouad.WhereYouAd.domains.user.persistence.repository.UserRepository; +import com.whereyouad.WhereYouAd.global.utils.RedisUtil; import lombok.RequiredArgsConstructor; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; @@ -20,6 +21,7 @@ public class UserService { private final UserRepository userRepository; private final PasswordEncoder passwordEncoder; + private final RedisUtil redisUtil; //회원가입 메서드 public SignUpResponse signUpUser(SignUpRequest request) { @@ -27,6 +29,15 @@ public SignUpResponse signUpUser(SignUpRequest request) { throw new UserSignUpException(UserErrorCode.USER_EMAIL_DUPLICATE); //이메일 중복 예외 } + //추가 : 이메일 인증되었는지 확인 -> 악의적 공격자가 이메일 인증을 건너뛰고 회원가입 URL 등으로 바로 들어왔을 경우 + //Redis 에 해당 이메일 인증이 완료되었는지 값을 꺼내보기 + String isEmailVerified = redisUtil.getData("VERIFIED:" + request.email()); + + //인증이 안되었다면, + if (isEmailVerified == null || !isEmailVerified.equals("TRUE")) { + throw new UserSignUpException(UserErrorCode.USER_EMAIL_NOT_VERIFIED); //예외 발생(UNAUTHORIZED) + } + //비밀번호 암호화 -> SecurityConfig 클래스 내 에서 BCryptPasswordEncoder 를 Bean 등록한거로 사용 String encodedPwd = passwordEncoder.encode(request.password()); @@ -38,7 +49,7 @@ public SignUpResponse signUpUser(SignUpRequest request) { .phoneNumber(request.phoneNumber()) .profileImageUrl(null) .status(UserStatus.ACTIVE) - .isEmailVerified(false) + .isEmailVerified(true) //회원가입 하는 사용자는 모두 이메일 인증 완료된 것 .build(); User savedUser = userRepository.save(user); From 22101f5934043fe067f4d917715a624dd92d7e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=98=A4=EC=A4=80=EC=98=81?= Date: Mon, 26 Jan 2026 22:25:08 +0900 Subject: [PATCH 07/17] =?UTF-8?q?:sparkles:=20feat:=20=EC=9D=B8=EC=A6=9D?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=A0=84=EC=86=A1=20API,=20=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=EC=BD=94=EB=93=9C=20=EA=B2=80=EC=A6=9D=20API=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80(/api/users/...)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/presentation/UserController.java | 24 +++++++++++++++-- .../presentation/docs/UserControllerDocs.java | 26 ++++++++++++++++++- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/UserController.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/UserController.java index fe397b3..af489f0 100644 --- a/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/UserController.java +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/UserController.java @@ -1,5 +1,9 @@ package com.whereyouad.WhereYouAd.domains.user.presentation; +import com.whereyouad.WhereYouAd.domains.user.application.dto.request.EmailRequest; +import com.whereyouad.WhereYouAd.domains.user.application.dto.request.EmailVerifyRequest; +import com.whereyouad.WhereYouAd.domains.user.application.dto.response.EmailSentResponse; +import com.whereyouad.WhereYouAd.domains.user.domain.service.EmailService; import com.whereyouad.WhereYouAd.domains.user.domain.service.UserService; import com.whereyouad.WhereYouAd.domains.user.application.dto.request.SignUpRequest; import com.whereyouad.WhereYouAd.domains.user.application.dto.response.SignUpResponse; @@ -19,14 +23,30 @@ public class UserController implements UserControllerDocs { private final UserService userService; + private final EmailService emailService; @PostMapping("/signup") - public ResponseEntity> signUp(@RequestBody @Valid SignUpRequest request) - { + public ResponseEntity> signUp(@RequestBody @Valid SignUpRequest request) { SignUpResponse signUpResponse = userService.signUpUser(request); return ResponseEntity.ok( DataResponse.created(signUpResponse) ); } + @PostMapping("/email-send") + public ResponseEntity> sendEmail(@RequestBody @Valid EmailRequest request) { + EmailSentResponse emailSentResponse = emailService.sendEmail(request.email()); + return ResponseEntity.ok( + DataResponse.from(emailSentResponse) + ); + } + + @PostMapping("/email-verify") + public ResponseEntity> verifyEmail(@RequestBody @Valid EmailVerifyRequest request) { + emailService.verifyEmailCode(request.email(), request.authCode()); + + return ResponseEntity.ok( + DataResponse.from("이메일 인증이 성공적으로 완료되었습니다.") + ); + } } diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/docs/UserControllerDocs.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/docs/UserControllerDocs.java index 531cd06..0954c98 100644 --- a/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/docs/UserControllerDocs.java +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/docs/UserControllerDocs.java @@ -1,6 +1,9 @@ package com.whereyouad.WhereYouAd.domains.user.presentation.docs; +import com.whereyouad.WhereYouAd.domains.user.application.dto.request.EmailRequest; +import com.whereyouad.WhereYouAd.domains.user.application.dto.request.EmailVerifyRequest; import com.whereyouad.WhereYouAd.domains.user.application.dto.request.SignUpRequest; +import com.whereyouad.WhereYouAd.domains.user.application.dto.response.EmailSentResponse; import com.whereyouad.WhereYouAd.domains.user.application.dto.response.SignUpResponse; import com.whereyouad.WhereYouAd.global.response.DataResponse; import io.swagger.v3.oas.annotations.Operation; @@ -13,11 +16,32 @@ public interface UserControllerDocs { @Operation( summary = "단순 회원가입 API", - description = "이메일, 비밀번호, 이름, 전화번호를 받아 회원가입을 진행합니다(이메일 인증 미진행상태)" + description = "이메일, 비밀번호, 이름, 전화번호를 받아 회원가입을 진행합니다(먼저 이메일 인증이 진행되어야 회원가입 가능)" ) @ApiResponses({ @ApiResponse(responseCode = "200", description = "성공"), @ApiResponse(responseCode = "400_2", description = "이메일 중복 회원 존재") }) public ResponseEntity> signUp(@RequestBody @Valid SignUpRequest request); + + @Operation( + summary = "이메일 인증코드 전송 API", + description = "입력받은 이메일로 인증코드를 전송합니다. 인증코드 재전송도 해당 API 를 호출합니다.\n\n" + + "테스트용 이메일은 'test' 로 시작하거나 'example.com' 으로 끝나야합니다. 테스트용 이메일의 인증코드는 서버 로그로 확인 가능합니다." + ) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "성공"), + @ApiResponse(responseCode = "400_3", description = "이메일 전송실패(이메일 오타 등)") + }) + public ResponseEntity> sendEmail(@RequestBody @Valid EmailRequest request); + + @Operation( + summary = "이메일 인증코드 인증 API", + description = "이메일과 인증코드를 받아 인증코드가 맞는지 검증합니다." + ) + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "성공"), + @ApiResponse(responseCode = "400_4", description = "실패(인증코드 불일치)") + }) + public ResponseEntity> verifyEmail(@RequestBody @Valid EmailVerifyRequest request); } From db7cdc44899c2e528d981ab92759409811a5f910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=98=A4=EC=A4=80=EC=98=81?= Date: Mon, 26 Jan 2026 22:25:36 +0900 Subject: [PATCH 08/17] =?UTF-8?q?:sparkles:=20feat:=20SecurityConfig=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=20=EC=97=86=EC=9D=B4=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?= =?UTF-8?q?=EC=9D=B8=EC=A6=9D=20=EC=A0=91=EA=B7=BC=20=EA=B0=80=EB=8A=A5?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../whereyouad/WhereYouAd/global/security/SecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/whereyouad/WhereYouAd/global/security/SecurityConfig.java b/src/main/java/com/whereyouad/WhereYouAd/global/security/SecurityConfig.java index 6f0ab6d..213c732 100644 --- a/src/main/java/com/whereyouad/WhereYouAd/global/security/SecurityConfig.java +++ b/src/main/java/com/whereyouad/WhereYouAd/global/security/SecurityConfig.java @@ -34,7 +34,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { ) .authorizeHttpRequests(auth -> auth .requestMatchers("/swagger-ui/**", "/v3/api-docs/**", "/swagger-ui.html").permitAll() //swagger 접근 허용 - .requestMatchers("/api/users/signup", "/api/auth/**").permitAll() //로그인, 회원가입 접근 허용 + .requestMatchers("/api/users/**", "/api/auth/**").permitAll() //로그인, 회원가입, 이메일 인증 접근 허용 .anyRequest().authenticated() //이외 접근은 인증 필요 ) //Spring Security 의 기본 UsernamePasswordAuthenticationFilter 앞에 JwtAuthenticationFilter 등록 From 852dc4ca461d2894152776b7342d5fcfe97b586e Mon Sep 17 00:00:00 2001 From: ojy0903 Date: Wed, 28 Jan 2026 14:47:26 +0900 Subject: [PATCH 09/17] =?UTF-8?q?:bug:=20fix:=20test=20=EB=94=94=EB=A0=89?= =?UTF-8?q?=ED=84=B0=EB=A6=AC=20application.yml=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20->=20=EB=B9=8C=EB=93=9C=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=ED=86=B5=EA=B3=BC=20=EB=AA=A9=EC=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/resources/application.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 8ff5a60..8e4d385 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -1,3 +1,18 @@ +spring: + + #이메일 인증 관련 설정 + mail: + host: smtp.gmail.com + port: 587 + username: "dummy-email@example.com" + password: "dummy-password" + properties: + mail: + smtp: + auth: true + starttls: + enable: true + jwt: - secret: "rEYzQhGBcEalhSkn2Fh4KaH+7qgWC/jsHGtQkr9/6IZT5irDbSJeyIW+Iq0UV2k1vX5Z72lEL28LfcDA+szesA==" + secret: "this-is-dummy-secret-key-for-test-environment-must-be-very-long-enough-for-hs512-algorithm-pass" #PR 빌드 통과를 위한 임의의 jwt.secret 값 -> 이 값이 아닌 추후에 협의한 랜덤값 사용 \ No newline at end of file From dbb18f7f1c1608dd5007d47279c4dc0d938047a0 Mon Sep 17 00:00:00 2001 From: ojy0903 Date: Wed, 28 Jan 2026 15:42:41 +0900 Subject: [PATCH 10/17] =?UTF-8?q?:bug:=20fix:=20test=20=EB=94=94=EB=A0=89?= =?UTF-8?q?=ED=84=B0=EB=A6=AC=20application.yml=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/resources/application.yml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 src/test/resources/application.yml diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml deleted file mode 100644 index 8e4d385..0000000 --- a/src/test/resources/application.yml +++ /dev/null @@ -1,18 +0,0 @@ -spring: - - #이메일 인증 관련 설정 - mail: - host: smtp.gmail.com - port: 587 - username: "dummy-email@example.com" - password: "dummy-password" - properties: - mail: - smtp: - auth: true - starttls: - enable: true - -jwt: - secret: "this-is-dummy-secret-key-for-test-environment-must-be-very-long-enough-for-hs512-algorithm-pass" - #PR 빌드 통과를 위한 임의의 jwt.secret 값 -> 이 값이 아닌 추후에 협의한 랜덤값 사용 \ No newline at end of file From da68b56e565de943b597a8ffd4e4e9e0a82d1ae6 Mon Sep 17 00:00:00 2001 From: ojy0903 Date: Wed, 28 Jan 2026 15:43:41 +0900 Subject: [PATCH 11/17] =?UTF-8?q?:sparkles:=20feat:=20.gitignore=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=20application.yml=20=EB=AC=B4=EC=8B=9C=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=A3=BC=EC=84=9D=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?&=20.env=20=EB=AC=B4=EC=8B=9C=20=EC=84=A4=EC=A0=95=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a50e99a..d0dc5cd 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,5 @@ out/ ### VS Code ### .vscode/ -src/main/resources/application.yml +#src/main/resources/application.yml +.env From 5634c1cb50d6722263f6da00b203e885ff23f198 Mon Sep 17 00:00:00 2001 From: ojy0903 Date: Wed, 28 Jan 2026 15:44:47 +0900 Subject: [PATCH 12/17] =?UTF-8?q?:sparkles:=20feat:=20application.yml=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80,=20.env=20=ED=98=95=EC=8B=9D=20=EC=98=88?= =?UTF-8?q?=EC=8B=9C=20=ED=8C=8C=EC=9D=BC=20.env.example=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 15 ++++++++++ src/main/resources/application.yml | 46 ++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .env.example create mode 100644 src/main/resources/application.yml diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..8f017c8 --- /dev/null +++ b/.env.example @@ -0,0 +1,15 @@ +# Database +DB_URL=jdbc:mysql://localhost:3306/whereyouad?serverTimezone=Asia/Seoul&characterEncoding=UTF-8 +DB_USERNAME=root +DB_PASSWORD= + +# Redis +REDIS_HOST=localhost +REDIS_PORT=6379 + +# Mail +MAIL_USERNAME=your-email@gmail.com +MAIL_PASSWORD=email-app-password + +# JWT +JWT_SECRET=your_very_long_and_secret_random_string_for_signing_tokens_to_match_HS512 \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..8be90f5 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,46 @@ +server: + port: 8080 + +spring: + application: + name: WhereYouAd + + # 데이터베이스 설정 + datasource: + url: ${DB_URL} # 예: jdbc:mysql://localhost:3306/whereyouad + username: ${DB_USERNAME} + password: ${DB_PASSWORD} + driver-class-name: com.mysql.cj.jdbc.Driver + + # JPA 설정 + jpa: + hibernate: + ddl-auto: update + properties: + hibernate: + format_sql: true + show_sql: true + + # Redis 설정 + data: + redis: + host: ${REDIS_HOST} + port: ${REDIS_PORT} + + # 이메일 설정 + mail: + host: smtp.gmail.com + port: 587 + username: ${MAIL_USERNAME} + password: ${MAIL_PASSWORD} #이메일 앱 비밀번호 입력 + properties: + mail: + smtp: + auth: true + starttls: + enable: true + +# JWT 또는 기타 커스텀 설정 (필요시) +jwt: + secret: ${JWT_SECRET} + expiration: 86400000 \ No newline at end of file From ba60c4fcbe14f0e4aeb37e7e499aa898f0f721d2 Mon Sep 17 00:00:00 2001 From: ojy0903 Date: Wed, 28 Jan 2026 15:51:03 +0900 Subject: [PATCH 13/17] =?UTF-8?q?:sparkles:=20feat:=20application.yml=20JW?= =?UTF-8?q?T=20=EC=98=B5=EC=85=98=20=EC=A3=BC=EC=84=9D=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8be90f5..e81a15e 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -43,4 +43,4 @@ spring: # JWT 또는 기타 커스텀 설정 (필요시) jwt: secret: ${JWT_SECRET} - expiration: 86400000 \ No newline at end of file +# expiration: 86400000 \ No newline at end of file From f9f14e703c7d16ed13c641b91259a8c58e63d5b1 Mon Sep 17 00:00:00 2001 From: jinnieusLab Date: Wed, 28 Jan 2026 16:07:30 +0900 Subject: [PATCH 14/17] =?UTF-8?q?:green=5Fheart:=20build:=20ci.yml=20?= =?UTF-8?q?=EB=82=B4=20env(=ED=99=98=EA=B2=BD=EB=B3=80=EC=88=98=EB=AA=85)?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 284990a..adea8f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,8 +44,11 @@ jobs: run: ./gradlew build # CI용, 환경변수로 DB 설정 env: - SPRING_DATASOURCE_URL: jdbc:mysql://localhost:3306/where_you_ad?serverTimezone=Asia/Seoul - SPRING_DATASOURCE_USERNAME: root - SPRING_DATASOURCE_PASSWORD: root - SPRING_DATA_REDIS_HOST: localhost - SPRING_DATA_REDIS_PORT: 6379 \ No newline at end of file + DB_URL: jdbc:mysql://localhost:3306/where_you_ad?serverTimezone=Asia/Seoul + DB_USERNAME: root + DB_PASSWORD: root + REDIS_HOST: localhost + REDIS_PORT: 6379 + MAIL_USERNAME: test@example.com + MAIL_PASSWORD: test_password + JWT_SECRET: test_secret_key_value_must_be_long_enough_for_security_tests \ No newline at end of file From b96059d78cd86356d696c12c6d42a70cd2ad8403 Mon Sep 17 00:00:00 2001 From: jinnieusLab Date: Wed, 28 Jan 2026 16:12:54 +0900 Subject: [PATCH 15/17] =?UTF-8?q?:green=5Fheart:=20build:=20ci.yml=20?= =?UTF-8?q?=EB=82=B4=20jwt=20secret=20=EC=9E=84=EC=9D=98=20=EC=9D=B8?= =?UTF-8?q?=EC=BD=94=EB=94=A9=20=EA=B0=92=EC=9C=BC=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index adea8f9..ad380ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,4 +51,4 @@ jobs: REDIS_PORT: 6379 MAIL_USERNAME: test@example.com MAIL_PASSWORD: test_password - JWT_SECRET: test_secret_key_value_must_be_long_enough_for_security_tests \ No newline at end of file + JWT_SECRET: dGhpcy1pcy1hLXRlc3Qtc2VjcmV0LWtleS1mb3ItY2ktdGVzdC1wdXJwb3Nlcw== \ No newline at end of file From a8a1b5941e0287cf85d65f0996e3cae70a959870 Mon Sep 17 00:00:00 2001 From: ojy0903 Date: Wed, 28 Jan 2026 19:10:54 +0900 Subject: [PATCH 16/17] =?UTF-8?q?:recycle:=20refactor:=20=EC=9D=B4?= =?UTF-8?q?=EB=A9=94=EC=9D=BC=20=EC=9D=B8=EC=A6=9D=20=EC=9A=94=EC=B2=AD=20?= =?UTF-8?q?DTO=20=EB=A5=BC=20=EA=B8=B0=EC=A1=B4=20EmailRequest,=20EmailVer?= =?UTF-8?q?ifyRequest=20->=20EmailRequest.class=20=EB=A1=9C=20=ED=86=B5?= =?UTF-8?q?=EC=9D=BC=ED=95=98=EC=97=AC=20=EB=82=B4=EB=B6=80=20=EA=B3=84?= =?UTF-8?q?=EC=B8=B5=EA=B5=AC=EC=A1=B0=EB=A1=9C=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=84=B0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/dto/request/EmailRequest.java | 20 ++++++++++++++----- .../dto/request/EmailVerifyRequest.java | 13 ------------ .../user/presentation/UserController.java | 5 ++--- .../presentation/docs/UserControllerDocs.java | 5 ++--- 4 files changed, 19 insertions(+), 24 deletions(-) delete mode 100644 src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailVerifyRequest.java diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailRequest.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailRequest.java index a3708f6..dd78fee 100644 --- a/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailRequest.java +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailRequest.java @@ -3,9 +3,19 @@ import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; -public record EmailRequest( - @NotBlank(message = "이메일은 필수입니다.") - @Email(message = "이메일 형식이 올바르지 않습니다.") - String email -) { +public class EmailRequest { + + public record Send ( + @NotBlank(message = "이메일은 필수입니다.") + @Email(message = "이메일 형식이 올바르지 않습니다.") + String email + ) {} + + public record Verify( + @NotBlank(message = "이메일은 필수입니다.") + @Email(message = "이메일 형식이 올바르지 않습니다.") + String email, + @NotBlank + String authCode + ) {} } diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailVerifyRequest.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailVerifyRequest.java deleted file mode 100644 index 4bfb4ca..0000000 --- a/src/main/java/com/whereyouad/WhereYouAd/domains/user/application/dto/request/EmailVerifyRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.whereyouad.WhereYouAd.domains.user.application.dto.request; - -import jakarta.validation.constraints.Email; -import jakarta.validation.constraints.NotBlank; - -public record EmailVerifyRequest( - @NotBlank(message = "이메일은 필수입니다.") - @Email(message = "이메일 형식이 올바르지 않습니다.") - String email, - @NotBlank - String authCode -) { -} diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/UserController.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/UserController.java index af489f0..b0c6d39 100644 --- a/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/UserController.java +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/UserController.java @@ -1,7 +1,6 @@ package com.whereyouad.WhereYouAd.domains.user.presentation; import com.whereyouad.WhereYouAd.domains.user.application.dto.request.EmailRequest; -import com.whereyouad.WhereYouAd.domains.user.application.dto.request.EmailVerifyRequest; import com.whereyouad.WhereYouAd.domains.user.application.dto.response.EmailSentResponse; import com.whereyouad.WhereYouAd.domains.user.domain.service.EmailService; import com.whereyouad.WhereYouAd.domains.user.domain.service.UserService; @@ -34,7 +33,7 @@ public ResponseEntity> signUp(@RequestBody @Valid S } @PostMapping("/email-send") - public ResponseEntity> sendEmail(@RequestBody @Valid EmailRequest request) { + public ResponseEntity> sendEmail(@RequestBody @Valid EmailRequest.Send request) { EmailSentResponse emailSentResponse = emailService.sendEmail(request.email()); return ResponseEntity.ok( DataResponse.from(emailSentResponse) @@ -42,7 +41,7 @@ public ResponseEntity> sendEmail(@RequestBody @V } @PostMapping("/email-verify") - public ResponseEntity> verifyEmail(@RequestBody @Valid EmailVerifyRequest request) { + public ResponseEntity> verifyEmail(@RequestBody @Valid EmailRequest.Verify request) { emailService.verifyEmailCode(request.email(), request.authCode()); return ResponseEntity.ok( diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/docs/UserControllerDocs.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/docs/UserControllerDocs.java index 0954c98..9048747 100644 --- a/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/docs/UserControllerDocs.java +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/user/presentation/docs/UserControllerDocs.java @@ -1,7 +1,6 @@ package com.whereyouad.WhereYouAd.domains.user.presentation.docs; import com.whereyouad.WhereYouAd.domains.user.application.dto.request.EmailRequest; -import com.whereyouad.WhereYouAd.domains.user.application.dto.request.EmailVerifyRequest; import com.whereyouad.WhereYouAd.domains.user.application.dto.request.SignUpRequest; import com.whereyouad.WhereYouAd.domains.user.application.dto.response.EmailSentResponse; import com.whereyouad.WhereYouAd.domains.user.application.dto.response.SignUpResponse; @@ -33,7 +32,7 @@ public interface UserControllerDocs { @ApiResponse(responseCode = "200", description = "성공"), @ApiResponse(responseCode = "400_3", description = "이메일 전송실패(이메일 오타 등)") }) - public ResponseEntity> sendEmail(@RequestBody @Valid EmailRequest request); + public ResponseEntity> sendEmail(@RequestBody @Valid EmailRequest.Send request); @Operation( summary = "이메일 인증코드 인증 API", @@ -43,5 +42,5 @@ public interface UserControllerDocs { @ApiResponse(responseCode = "200", description = "성공"), @ApiResponse(responseCode = "400_4", description = "실패(인증코드 불일치)") }) - public ResponseEntity> verifyEmail(@RequestBody @Valid EmailVerifyRequest request); + public ResponseEntity> verifyEmail(@RequestBody @Valid EmailRequest.Verify request); } From 6b3dfec7cfb7258357917a41bcb8136a9455bcce Mon Sep 17 00:00:00 2001 From: ojy0903 Date: Wed, 28 Jan 2026 19:12:29 +0900 Subject: [PATCH 17/17] =?UTF-8?q?:truck:=20rename:=20UserErrorCode=20?= =?UTF-8?q?=EB=82=B4=EB=B6=80=20USER=5F400=5FN=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=88=AB=EC=9E=90=20=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domains/user/exception/code/UserErrorCode.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/whereyouad/WhereYouAd/domains/user/exception/code/UserErrorCode.java b/src/main/java/com/whereyouad/WhereYouAd/domains/user/exception/code/UserErrorCode.java index c126d4e..50a7027 100644 --- a/src/main/java/com/whereyouad/WhereYouAd/domains/user/exception/code/UserErrorCode.java +++ b/src/main/java/com/whereyouad/WhereYouAd/domains/user/exception/code/UserErrorCode.java @@ -8,10 +8,11 @@ @Getter @AllArgsConstructor public enum UserErrorCode implements BaseErrorCode { - USER_EMAIL_DUPLICATE(HttpStatus.BAD_REQUEST, "USER_400_2", "이미 사용중인 이메일 입니다."), + USER_EMAIL_DUPLICATE(HttpStatus.BAD_REQUEST, "USER_400_1", "이미 사용중인 이메일 입니다."), + USER_EMAIL_NOT_VALID(HttpStatus.BAD_REQUEST, "USER_400_2", "해당 이메일로 메일 전송에 실패했습니다."), + USER_EMAIL_AUTH_INVALID(HttpStatus.BAD_REQUEST, "USER_400_3", "인증 코드가 올바르지 않습니다."), + USER_EMAIL_NOT_VERIFIED(HttpStatus.UNAUTHORIZED, "USER_401_1", "이메일 인증이 진행되지 않았습니다."), - USER_EMAIL_NOT_VALID(HttpStatus.BAD_REQUEST, "USER_400_3", "해당 이메일로 메일 전송에 실패했습니다."), - USER_EMAIL_AUTH_INVALID(HttpStatus.BAD_REQUEST, "USER_400_4", "인증 코드가 올바르지 않습니다.") ; private final HttpStatus httpStatus;