Skip to content

Commit

Permalink
📝 :: email code fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lgwk42 committed Dec 7, 2024
1 parent 74df1dd commit b8c3756
Showing 1 changed file with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@ public class EmailService {
@Value("${spring.mail.username}")
private String userName;

public void makeRandomNum() {
Random r = new Random();
String randomNumber = "";
for (int i = 0; i < 6; i++) {
randomNumber += Integer.toString(r.nextInt(10));
}
authNumber = Integer.parseInt(randomNumber);
}

public void mailSend(String setFrom, String toMail, String title, String content) {
MimeMessage message = javaMailSender.createMimeMessage();
try {
Expand All @@ -53,18 +44,16 @@ public void mailSend(String setFrom, String toMail, String title, String content
valOperations.set(toMail, Integer.toString(authNumber), 180, TimeUnit.SECONDS);
}

public String joinEmail(String email) {
public void joinEmail(String email) {
makeRandomNum();
String customerMail = email;
String title = "회원 가입을 위한 이메일입니다!";
String content =
"이메일을 인증하기 위한 절차입니다." +
"<br><br>" +
"인증 번호는 " + authNumber + "입니다." +
"<br>" +
"회원 가입 폼에 해당 번호를 입력해주세요.";
mailSend(userName, customerMail, title, content);
return Integer.toString(authNumber);
mailSend(userName, email, title, content);
}

public BaseResponse checkAuthNum(String email, String authNum) {
Expand All @@ -77,4 +66,13 @@ public BaseResponse checkAuthNum(String email, String authNum) {
}
}

public void makeRandomNum() {
Random r = new Random();
String randomNumber = "";
for (int i = 0; i < 6; i++) {
randomNumber += Integer.toString(r.nextInt(10));
}
authNumber = Integer.parseInt(randomNumber);
}

}

0 comments on commit b8c3756

Please sign in to comment.