Skip to content

Commit 01b7d0d

Browse files
committed
Inprove email template
1 parent dd1d73d commit 01b7d0d

File tree

3 files changed

+13
-43
lines changed

3 files changed

+13
-43
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111
<groupId>com.github.throyer.common.spring-boot</groupId>
1212
<artifactId>api</artifactId>
13-
<version>3.0.1</version>
13+
<version>3.0.2</version>
1414
<name>Common API</name>
1515
<description>Exemplo de api simples com Spring Boot</description>
1616

src/main/java/com/github/throyer/common/springboot/domain/models/emails/RecoveryEmail.java

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,11 @@
55
import org.thymeleaf.context.Context;
66

77
public class RecoveryEmail implements Email {
8-
9-
private static final Integer FIRST = 0;
10-
private static final Integer SECOND = 1;
11-
private static final Integer THIRD = 2;
12-
private static final Integer FOURTH = 3;
13-
148
private final String destination;
159
private final String subject;
1610
private final String name;
11+
private final String code;
1712

18-
private final String first;
19-
private final String second;
20-
private final String third;
21-
private final String fourth;
22-
2313
public RecoveryEmail(
2414
String destination,
2515
String subject,
@@ -29,13 +19,7 @@ public RecoveryEmail(
2919
this.destination = destination;
3020
this.subject = subject;
3121
this.name = name;
32-
33-
var code = recoveryCode.split("");
34-
35-
this.first = code[FIRST];
36-
this.second = code[SECOND];
37-
this.third = code[THIRD];
38-
this.fourth = code[FOURTH];
22+
this.code = recoveryCode;
3923
}
4024

4125
@Override
@@ -57,12 +41,8 @@ public String getTemplate() {
5741
public Context getContext() {
5842
var context = new Context();
5943

60-
context.setVariable("name", this.name);
61-
62-
context.setVariable("first", this.first);
63-
context.setVariable("second", this.second);
64-
context.setVariable("third", this.third);
65-
context.setVariable("fourth", this.fourth);
44+
context.setVariable("name", this.name);
45+
context.setVariable("code", this.code);
6646

6747
return context;
6848
}

src/main/resources/templates/recovery-password.html

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@
7272
}
7373

7474
.code-box {
75-
width: 88px;
76-
height: 88px;
7775
background: #7962f7;
78-
box-shadow: 0px 12px 12px rgba(66, 70, 86, 0.08),
76+
box-shadow:
77+
0px 12px 12px rgba(66, 70, 86, 0.08),
7978
0px 16px 24px rgba(66, 70, 86, 0.08);
79+
8080
border-radius: 16px;
8181
text-align: center;
8282
color: #ffffff;
83-
margin: 10px 0px;
83+
padding: 10px 20px;
8484
font-size: 56px;
8585
}
8686

@@ -196,20 +196,10 @@
196196
<table align="center" class="table-code-box">
197197
<tbody>
198198
<tr>
199-
<td th:text="${first}" class="code-box">
200-
first
201-
</td>
202-
<td class="code-box-spacing"></td>
203-
<td th:text="${second}" class="code-box">
204-
second
205-
</td>
206-
<td class="code-box-spacing"></td>
207-
<td th:text="${third}" class="code-box">
208-
third
209-
</td>
210-
<td class="code-box-spacing"></td>
211-
<td th:text="${fourth}" class="code-box">
212-
fourth
199+
<td>
200+
<span class="code-box" th:text="${code}">
201+
code
202+
</span>
213203
</td>
214204
</tr>
215205
</tbody>

0 commit comments

Comments
 (0)