From 10315d77b39de4c567d6c4c16b7fedbf1a73d0d9 Mon Sep 17 00:00:00 2001 From: Jeongho Date: Wed, 22 May 2024 02:05:17 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=20=EC=9D=B4=EC=8A=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../register/controller/RegisterController.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/meetup/teame/backend/domain/register/controller/RegisterController.java b/src/main/java/com/meetup/teame/backend/domain/register/controller/RegisterController.java index e62a941..d8c8f0b 100644 --- a/src/main/java/com/meetup/teame/backend/domain/register/controller/RegisterController.java +++ b/src/main/java/com/meetup/teame/backend/domain/register/controller/RegisterController.java @@ -3,6 +3,7 @@ import com.meetup.teame.backend.domain.auth.oauth.service.KakaoService; import com.meetup.teame.backend.domain.email.dto.EmailRequest; import com.meetup.teame.backend.domain.email.service.EmailService; +import com.meetup.teame.backend.domain.login.service.LoginService; import com.meetup.teame.backend.domain.register.dto.RegisterRequest; import com.meetup.teame.backend.domain.register.service.RegisterService; import com.meetup.teame.backend.domain.user.service.UserService; @@ -24,6 +25,7 @@ public class RegisterController { private final EmailService emailService; private final KakaoService kakaoService; private final UserService userService; + private final LoginService loginService; @Operation(summary = "인증 번호 발송", description = """ 이메일 입력 하고 인증번호 발송하면 이메일로 인증번호 발송합니다. @@ -32,9 +34,15 @@ public class RegisterController { """) @PostMapping("/send-email") public ResponseEntity sendEmail(@RequestBody EmailRequest request) { - int authNumber = emailService.sendMail(request.getEmail()); - String number = "" + authNumber; - return ResponseEntity.ok().body(number); + boolean existEmail = loginService.userExists(request.getEmail()); + if (!existEmail) { + int authNumber = emailService.sendMail(request.getEmail()); + String number = "" + authNumber; + return ResponseEntity.ok().body(number); + } + else{ + return ResponseEntity.ok().body("이미 등록된 사용자 입니다."); + } } //이름, 비밀번호, 생년월일, 거주지 입력