Skip to content

Commit

Permalink
Merge pull request #207 from Wingle-SMWU/feat/이메일-문구-수정-#185
Browse files Browse the repository at this point in the history
Feat/이메일 문구 수정 #185
  • Loading branch information
LeeJE20 committed Jul 10, 2023
2 parents ffbf923 + 7364a33 commit fcf9e30
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public class AcceptanceMail extends Mail {
public AcceptanceMail(String name) {
super("acceptance", "윙글(Wingle) 가입을 환영합니다!", name);
super("acceptance", "[WINGLE] 가입을 환영합니다!");
super.values.put("name", name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public class ApplyMail extends Mail {
public ApplyMail(String name) {
super("apply", "윙글(Wingle) 가입 신청이 완료되었습니다!", name);
super("apply", "[WINGLE] 가입 신청이 완료되었습니다!");
super.values.put("name", name);
}
}
5 changes: 3 additions & 2 deletions wingle/src/main/java/kr/co/wingle/member/mailVo/CodeMail.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ public class CodeMail extends Mail {
public static final long VALID_TIME = 1000 * 60 * 5L; // 5분

public CodeMail() {
super("code", "윙글(Wingle) 이메일 인증코드");
super.setValue(createCode());
super("code", "[WINGLE] 회원가입 인증번호");
super.values.put("code", createCode());

}

private String createCode() {
Expand Down
9 changes: 4 additions & 5 deletions wingle/src/main/java/kr/co/wingle/member/mailVo/Mail.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package kr.co.wingle.member.mailVo;

import java.util.HashMap;
import java.util.Map;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PROTECTED)
public class Mail {
protected String fileName;
protected String title;
@Setter
protected String value;
protected Map<String, String> values = new HashMap<>();

protected Mail(String fileName, String title) {
this.fileName = fileName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package kr.co.wingle.member.mailVo;

public class RejectionMail extends Mail {
public RejectionMail(String reason) {
super("rejection", "윙글(Wingle)에 가입하실 수 없습니다.", reason);
public RejectionMail(String name, String reason) {
super("rejection", "[WINGLE] 회원가입 결과 안내");
super.values.put("name", name);
super.values.put("reason", reason);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public PermissionResponseDto sendRejectionMail(RejectionRequestDto rejectionRequ

member.setPermission(Permission.DENY.getStatus());
memberService.saveRejectionReason(rejectionRequestDto);
mailService.sendEmail(member.getEmail(), new RejectionMail(rejectionRequestDto.getReason()));
mailService.sendEmail(member.getEmail(), new RejectionMail(member.getName(), rejectionRequestDto.getReason()));
return PermissionResponseDto.of(userId, false);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kr.co.wingle.member.service;

import java.io.UnsupportedEncodingException;
import java.util.Map;

import javax.mail.Message.RecipientType;
import javax.mail.MessagingException;
Expand Down Expand Up @@ -36,7 +37,7 @@ public String sendEmail(String to, Mail mail) {
try {
this.mail = mail;
if (mail instanceof CodeMail) {
final String code = mail.getValue();
final String code = mail.getValues().get("code");
redisUtil.setDataExpire(to, code, CodeMail.VALID_TIME);
}
MimeMessage message = createMessage(to);
Expand All @@ -63,10 +64,14 @@ private MimeMessage createMessage(String to) throws MessagingException, Unsuppor
}

private String setContext() {
final String name = "value";
Context context = new Context();
if (!mail.getValue().isEmpty())
context.setVariable(name, mail.getValue());
Map<String, String> values = mail.getValues();

if (!values.isEmpty()) {
for (String key : values.keySet())
context.setVariable(key, values.get(key));
}

return templateEngine.process(mail.getFileName(), context);
}
}
36 changes: 27 additions & 9 deletions wingle/src/main/resources/templates/acceptance.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,34 @@
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>가입 수락</title>

<p>안녕하세요, <span th:text="${value}"></span> 윙그리 님!</p>
<p>학생증 인증이 완료되었습니다.</p>
<p>아래 '바로가기'를 누르시면 로그인 페이지로 연결됩니다.</p>
<p>감사합니다.</p>

<a href="https://wingle-kder.vercel.app/auth/login">윙글 바로가기</a>
</head>
<body>

<h1><img src="https://wingle-bucket.s3.ap-northeast-2.amazonaws.com/wingleResource/wingle_logo.png" alt="logo"
width="138" height="83"/></h1>
<p style="font-size:44px">
<strong>&nbsp;
<span th:text="${name}"></span> 윙그리님<br/>&nbsp;가입을 환영합니다!&nbsp;
</strong>
</p>
<p>&nbsp; 안녕하세요 <span th:text="${name}"></span>님!<br/>&nbsp; 학생증 인증이 완료되었습니다.<br/>
&nbsp; 아래 링크를 누르면 WINGLE 로그인 페이지로 이동합니다.<br/><br/></p>
<table style="height: 18px; width: 53.3865%; border-collapse: collapse; border-color: #fafafa; background-color: #fafafa; margin-left: auto; margin-right: auto;"
border="1">
<tbody>
<tr style="height: 18px;">
<td style="width: 100%; text-align: center; height: 18px;">
<p>
<span style="color: #ff6600;">
<a style="color: #ff6600;" href="https://wingle-national.netlify.app/auth/login">
<strong>WINGLE 바로가기</strong>
</a>
</span>
</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>&nbsp; 감사합니다.&nbsp;</p>
</body>
</html>
36 changes: 26 additions & 10 deletions wingle/src/main/resources/templates/apply.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,33 @@
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>가입 신청 완료</title>

<p>안녕하세요, <span th:text="${value}"></span> 윙그리 님!</p>
<p>가입 신청이 완료되었습니다.</p>
<p>가입이 승인되면 다시 한 번 메일을 보내드리겠습니다.</p>
<p>메일이 오지 않는다면 스팸함을 확인하거나 wingle.kr@gmail.com으로 문의해주세요.</p>
<p>감사합니다.</p>

<a href="https://wingle-kder.vercel.app/auth/login">윙글 바로가기</a>
</head>
<body>

<h1>
<img src="https://wingle-bucket.s3.ap-northeast-2.amazonaws.com/wingleResource/wingle_logo.png" alt="logo"
width="138" height="83"/>
</h1>
<p style="font-size:44px"><strong>&nbsp;안녕하세요.<br/>&nbsp;WINGLE입니다.</strong></p>
<p>안녕하세요, <span th:text="${name}"></span> 윙그리 님!</p>
<p>가입 신청이 완료되었습니다.</p>
<p>가입이 승인되면 다시 한 번 메일을 보내드리겠습니다.</p>
<p>메일이 오지 않는다면 스팸함을 확인하거나 wingle.kr@gmail.com으로 문의해주세요.</p>
<p>감사합니다.</p>
<table style="height: 18px; width: 53.3865%; border-collapse: collapse; border-color: #fafafa; background-color: #fafafa; margin-left: auto; margin-right: auto;"
border="1">
<tbody>
<tr style="height: 18px;">
<td style="width: 100%; text-align: center; height: 18px;">
<p>
<span style="color: #ff6600;">
<a style="color: #ff6600;" href="https://wingle-national.netlify.app/auth/login">
<strong>WINGLE 바로가기</strong>
</a>
</span>
</p>
</td>
</tr>
</tbody>
</table>
</body>
</html>
28 changes: 16 additions & 12 deletions wingle/src/main/resources/templates/code.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<body>
<div style="margin:100px;">
<h1> 안녕하세요.</h1>
<h1> 윙글(Wingle) 입니다.</h1>
<br>
<p>아래 코드를 복사해 입력해주세요
<p>
<div align="center" style="border:1px solid black; font-family:verdana;">
<h3 style="color:blue"> 회원가입 인증 코드 입니다. </h3>
<div style="font-size:130%" th:text="${value}"></div>
</div>
<br/>
<div style="margin:100px;font-family: Arial;">
<h1><img src="https://wingle-bucket.s3.ap-northeast-2.amazonaws.com/wingleResource/wingle_logo.png" alt="logo"
width="138" height="83"/></h1>
<p style="font-size:44px"><strong>&nbsp;안녕하세요.<br/>&nbsp;WINGLE입니다.</strong></p>
<p>&nbsp; 본 메일은 WINGLE 회원가입을 위한 인증메일입니다.
<br/>&nbsp; 아래의 인증번호를 입력하여 본인확인을 해주시기를 바랍니다.</p>
<p>&nbsp;</p>
<table style="height: 18px; width: 53.3865%; border-collapse: collapse; border-color: #fafafa; background-color: #fafafa; margin-left: auto; margin-right: auto; border: 1px solid;">
<tbody>
<tr style="height: 18px;">
<td style="width: 100%; text-align: center; height: 18px;">
<p><span style="color: #ff6600;"><strong><span th:text="${code}"></span></strong></span></p>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
34 changes: 25 additions & 9 deletions wingle/src/main/resources/templates/rejection.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,32 @@
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>가입 거절</title>
<p>안녕하세요, WINGLE입니다.</p>
<p>학생증 인증에 실패하였습니다.</p>
<span th:text="${value}"></span>
<p>WINGLE 서비스를 이용하시려면 아래 '바로가기'를 눌러 회원가입을 다시 진행해주시기 바랍니다.</p>
<p>감사합니다.</p>

<a href="https://wingle-kder.vercel.app/auth/signup">윙글 바로가기</a>
</head>
<body>

<h1><img src="https://wingle-bucket.s3.ap-northeast-2.amazonaws.com/wingleResource/wingle_logo.png" alt="logo"
width="138" height="83"/></h1>
<p style="font-size:44px"><strong>&nbsp;안녕하세요.<br/>&nbsp;WINGLE입니다.</strong></p>
<p>&nbsp; 안녕하세요 <span th:text="${name}"></span><br/>
&nbsp; 아래와 같은 사유로 가입에 실패하였습니다.&nbsp;<br/>&nbsp;
<strong>[사유 : <span th:text="${reason}"></span>]</strong><br/>&nbsp;&nbsp;
<br/>&nbsp; 아래 링크를 눌러 회원가입을 다시 진행해주시기 바랍니다.&nbsp;</p>
<table style="height: 18px; width: 53.3865%; border-collapse: collapse; border-color: #fafafa; background-color: #fafafa; margin-left: auto; margin-right: auto;"
border="1">
<tbody>
<tr style="height: 18px;">
<td style="width: 100%; text-align: center; height: 18px;">
<p>
<span style="color: #ff6600;">
<a style="color: #ff6600;" href="https://wingle-national.netlify.app/auth/signup">
<strong>WINGLE 바로가기</strong>
</a>
</span>
</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>&nbsp; 감사합니다.&nbsp;</p>
</body>
</html>

0 comments on commit fcf9e30

Please sign in to comment.