-
- Capple 회원가입을 위한 인증번호입니다.
+
+ Qapple 회원가입을 위한 인증번호입니다.
-
아래 코드를 회원가입 창으로 돌아가 입력해주세요.
+
+
아래 코드를 회원가입 창으로 돌아가 입력해주세요.
-
인증 코드
-
+
인증 코드
+
12345
From dfa244c49b663f5dcffb9641b3abb4c3bb2e55fa Mon Sep 17 00:00:00 2001
From: Jaewon Lee <58386334+jaewonLeeKOR@users.noreply.github.com>
Date: Mon, 23 Sep 2024 01:38:15 +0900
Subject: [PATCH 2/3] =?UTF-8?q?feat:=20#176=20=EC=9D=B8=EC=A6=9D=20?=
=?UTF-8?q?=EB=A9=94=EC=9D=BC=20=EC=83=9D=EC=84=B1=EC=8B=9C=20=ED=9B=84?=
=?UTF-8?q?=EB=B3=B4=EB=AC=B8=EC=9E=90=EC=97=B4=20=EC=9D=B8=EB=8D=B1?=
=?UTF-8?q?=EC=8A=A4=20=EC=83=9D=EC=84=B1=20=EC=98=A4=EB=A5=98=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
---
.../com/server/capple/domain/mail/service/MailUtilImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/com/server/capple/domain/mail/service/MailUtilImpl.java b/src/main/java/com/server/capple/domain/mail/service/MailUtilImpl.java
index 60e91b0a..2901e3c6 100644
--- a/src/main/java/com/server/capple/domain/mail/service/MailUtilImpl.java
+++ b/src/main/java/com/server/capple/domain/mail/service/MailUtilImpl.java
@@ -42,7 +42,7 @@ private String generateCertCode() {
final Integer certCodeLength = 5;
String certCode = "";
for (int i = 0; i < certCodeLength; i++) {
- Long idx = Math.round(Math.random() * candidateChars.length());
+ Long idx = (long) (Math.random() * candidateChars.length());
certCode += candidateChars.charAt(idx.intValue());
}
return certCode;
From 052ff1ceffb768d5b5d8a988561c4c9e993ba694 Mon Sep 17 00:00:00 2001
From: Jaewon Lee <58386334+jaewonLeeKOR@users.noreply.github.com>
Date: Mon, 23 Sep 2024 01:45:26 +0900
Subject: [PATCH 3/3] =?UTF-8?q?feat:=20#176=20=EC=9D=B8=EC=A6=9D=20?=
=?UTF-8?q?=EB=A9=94=EC=9D=BC=20=EB=B0=9C=EC=86=A1=20=EB=A9=94=EC=84=9C?=
=?UTF-8?q?=EB=93=9C=20=EB=B9=84=EB=8F=99=EA=B8=B0=20=EC=B2=98=EB=A6=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/server/capple/CappleApplication.java | 2 ++
.../capple/domain/mail/service/MailServiceImpl.java | 11 ++++++++---
.../server/capple/domain/mail/service/MailUtil.java | 4 +++-
.../capple/domain/mail/service/MailUtilImpl.java | 13 ++++++++++---
4 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/server/capple/CappleApplication.java b/src/main/java/com/server/capple/CappleApplication.java
index bcd0e14b..a032fc21 100644
--- a/src/main/java/com/server/capple/CappleApplication.java
+++ b/src/main/java/com/server/capple/CappleApplication.java
@@ -7,6 +7,7 @@
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
+import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.time.ZoneId;
@@ -18,6 +19,7 @@
@EnableConfigurationProperties
@EnableScheduling
@EnableCaching
+@EnableAsync
public class CappleApplication {
public static void main(String[] args) {
diff --git a/src/main/java/com/server/capple/domain/mail/service/MailServiceImpl.java b/src/main/java/com/server/capple/domain/mail/service/MailServiceImpl.java
index 08b36210..8ac8df0f 100644
--- a/src/main/java/com/server/capple/domain/mail/service/MailServiceImpl.java
+++ b/src/main/java/com/server/capple/domain/mail/service/MailServiceImpl.java
@@ -7,8 +7,10 @@
import com.server.capple.global.exception.RestApiException;
import com.server.capple.global.exception.errorCode.MailErrorCode;
import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
+@Slf4j
@Service
@RequiredArgsConstructor
public class MailServiceImpl implements MailService {
@@ -19,9 +21,12 @@ public class MailServiceImpl implements MailService {
@Override
public Boolean sendMailAddressCertificationMail(String email, Boolean isWhiteList) {
- String certCode = mailUtil.sendMailAddressCertificationMail(email, isWhiteList);
- String emailJwt = jwtService.createJwtFromEmail(email);
- return mailRedisRepository.save(emailJwt, certCode);
+ mailUtil.sendMailAddressCertificationMail(email, isWhiteList).thenAccept(certCode -> {
+ String emailJwt = jwtService.createJwtFromEmail(email);
+ mailRedisRepository.save(emailJwt, certCode);
+ log.info("메일 발송 완료 : {}", email);
+ });
+ return true;
}
@Override
diff --git a/src/main/java/com/server/capple/domain/mail/service/MailUtil.java b/src/main/java/com/server/capple/domain/mail/service/MailUtil.java
index 538c7fa2..efe6018d 100644
--- a/src/main/java/com/server/capple/domain/mail/service/MailUtil.java
+++ b/src/main/java/com/server/capple/domain/mail/service/MailUtil.java
@@ -1,10 +1,12 @@
package com.server.capple.domain.mail.service;
+import java.util.concurrent.CompletableFuture;
+
public interface MailUtil {
public static Boolean emailAddressFormVerification(String emailAddress) {
String emailRegex = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,6}$";
return emailAddress.matches(emailRegex);
}
- String sendMailAddressCertificationMail(String receiver, Boolean isWhiteList);
+ CompletableFuture
sendMailAddressCertificationMail(String receiver, Boolean isWhiteList);
}
diff --git a/src/main/java/com/server/capple/domain/mail/service/MailUtilImpl.java b/src/main/java/com/server/capple/domain/mail/service/MailUtilImpl.java
index 2901e3c6..72037a52 100644
--- a/src/main/java/com/server/capple/domain/mail/service/MailUtilImpl.java
+++ b/src/main/java/com/server/capple/domain/mail/service/MailUtilImpl.java
@@ -5,13 +5,18 @@
import jakarta.mail.MessagingException;
import jakarta.mail.internet.MimeMessage;
import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;
+import java.util.concurrent.CompletableFuture;
+
+@Slf4j
@Component
@RequiredArgsConstructor
public class MailUtilImpl implements MailUtil {
@@ -20,10 +25,11 @@ public class MailUtilImpl implements MailUtil {
@Value("${mail.white-list-cert-code}")
private String whiteListCertCode;
+ @Async
@Override
- public String sendMailAddressCertificationMail(String receiver, Boolean isWhiteList) {
+ public CompletableFuture sendMailAddressCertificationMail(String receiver, Boolean isWhiteList) {
String certCode = generateCertCode();
- if(isWhiteList) certCode = whiteListCertCode;
+ if (isWhiteList) certCode = whiteListCertCode;
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
try {
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, false, "UTF-8");
@@ -31,8 +37,9 @@ public String sendMailAddressCertificationMail(String receiver, Boolean isWhiteL
mimeMessageHelper.setSubject("[Capple] 회원가입 인증코드 안내");
mimeMessageHelper.setText(setCertMailContext(certCode), true);
javaMailSender.send(mimeMessage);
- return certCode;
+ return CompletableFuture.completedFuture(certCode);
} catch (MessagingException e) {
+ log.error(MailErrorCode.MULTI_PART_CRAETION_FAILED.getMessage());
throw new RestApiException(MailErrorCode.MULTI_PART_CRAETION_FAILED);
}
}