feat(email): 实现邮件模板系统并添加邮件发送功能
- 新增 EmailTemplateUtil 工具类,用于管理邮件模板和发送逻辑 - 在 MainController 中集成 EmailTemplateUtil,用于发送注册成功邮件 - 添加密码重置和通用通知邮件模板 - 实现邮件发送的降级机制,HTML邮件发送失败时自动发送文本邮件 - 添加邮件模板配置和发送设置配置 - 提供异步发送和模板缓存优化建议
This commit is contained in:
@@ -38,6 +38,7 @@ import com.gxwebsoft.common.system.param.UserParam;
|
||||
import com.gxwebsoft.common.system.result.CaptchaResult;
|
||||
import com.gxwebsoft.common.system.result.LoginResult;
|
||||
import com.gxwebsoft.common.system.service.*;
|
||||
import com.gxwebsoft.common.system.util.EmailTemplateUtil;
|
||||
import com.wf.captcha.SpecCaptcha;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -95,6 +96,8 @@ public class MainController extends BaseController {
|
||||
private UserRefereeService userRefereeService;
|
||||
@Resource
|
||||
private EmailRecordService emailRecordService;
|
||||
@Resource
|
||||
private EmailTemplateUtil emailTemplateUtil;
|
||||
|
||||
|
||||
@ApiOperation("用户登录")
|
||||
@@ -644,14 +647,8 @@ public class MainController extends BaseController {
|
||||
String access_token = JwtUtil.buildToken(new JwtSubject(phone, addUser.getTenantId()),
|
||||
tokenExpireTime, configProperties.getTokenKey());
|
||||
// 发送邮件通知
|
||||
String title = "恭喜!您的WebSoft账号已注册成功";
|
||||
String appUrl = "\r\n用户名:" + username;
|
||||
String passwordStr = "\r\n密码:" + password;
|
||||
String appName = "\r\n手机号码:" + phone;
|
||||
String content = title + appUrl + appName + passwordStr;
|
||||
// 发送邮件通知
|
||||
if (email != null) {
|
||||
emailRecordService.sendEmail(title, content, email, addUser.getTenantId());
|
||||
if(ObjectUtil.isNotEmpty(addUser) && email != null){
|
||||
emailTemplateUtil.sendRegisterSuccessEmail(username, phone, password, email, addUser.getTenantId());
|
||||
}
|
||||
return success("注册成功", new LoginResult(access_token, addUser));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
package com.gxwebsoft.common.system.util;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.gxwebsoft.common.system.service.EmailRecordService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 邮件模板工具类
|
||||
* 统一管理邮件模板和发送逻辑
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2024-08-28
|
||||
*/
|
||||
@Component
|
||||
public class EmailTemplateUtil {
|
||||
|
||||
@Resource
|
||||
private EmailRecordService emailRecordService;
|
||||
|
||||
/**
|
||||
* 发送注册成功邮件
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param phone 手机号
|
||||
* @param password 密码
|
||||
* @param email 邮箱
|
||||
* @param tenantId 租户ID
|
||||
*/
|
||||
public void sendRegisterSuccessEmail(String username, String phone, String password, String email, Integer tenantId) {
|
||||
try {
|
||||
String title = "恭喜!您的账号已注册成功";
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("username", username);
|
||||
data.put("phone", phone);
|
||||
data.put("password", password);
|
||||
data.put("email", email);
|
||||
|
||||
emailRecordService.sendHtmlEmail(title, "register-success.html", data, new String[]{email});
|
||||
} catch (Exception e) {
|
||||
// 如果HTML邮件发送失败,降级为文本邮件
|
||||
String content = "恭喜!您的WebSoft账号已注册成功\r\n用户名:" + username + "\r\n手机号码:" + phone + "\r\n密码:" + password;
|
||||
emailRecordService.sendEmail("恭喜!您的WebSoft账号已注册成功", content, email, tenantId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送密码重置邮件
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param phone 手机号
|
||||
* @param newPassword 新密码
|
||||
* @param email 邮箱
|
||||
* @param tenantId 租户ID
|
||||
*/
|
||||
public void sendPasswordResetEmail(String username, String phone, String newPassword, String email, Integer tenantId) {
|
||||
try {
|
||||
String title = "WebSoft密码重置通知";
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("username", username);
|
||||
data.put("phone", phone);
|
||||
data.put("newPassword", newPassword);
|
||||
data.put("resetTime", DateUtil.now());
|
||||
|
||||
emailRecordService.sendHtmlEmail(title, "password-reset.html", data, new String[]{email});
|
||||
} catch (Exception e) {
|
||||
// 如果HTML邮件发送失败,降级为文本邮件
|
||||
String content = "您的WebSoft账号密码已重置\r\n用户名:" + username + "\r\n手机号码:" + phone + "\r\n新密码:" + newPassword + "\r\n重置时间:" + DateUtil.now();
|
||||
emailRecordService.sendEmail("WebSoft密码重置通知", content, email, tenantId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送通用通知邮件
|
||||
*
|
||||
* @param title 邮件标题
|
||||
* @param content 邮件内容
|
||||
* @param email 收件人邮箱
|
||||
* @param tenantId 租户ID
|
||||
* @param greeting 问候语(可选)
|
||||
* @param infoMessage 提示信息(可选)
|
||||
* @param actionUrl 操作链接(可选)
|
||||
* @param actionText 操作按钮文字(可选)
|
||||
*/
|
||||
public void sendNotificationEmail(String title, String content, String email, Integer tenantId,
|
||||
String greeting, String infoMessage, String actionUrl, String actionText) {
|
||||
try {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("title", title);
|
||||
data.put("content", content);
|
||||
data.put("sendTime", DateUtil.now());
|
||||
|
||||
if (greeting != null) {
|
||||
data.put("greeting", greeting);
|
||||
}
|
||||
if (infoMessage != null) {
|
||||
data.put("infoMessage", infoMessage);
|
||||
}
|
||||
if (actionUrl != null) {
|
||||
data.put("actionUrl", actionUrl);
|
||||
}
|
||||
if (actionText != null) {
|
||||
data.put("actionText", actionText);
|
||||
}
|
||||
|
||||
emailRecordService.sendHtmlEmail(title, "notification.html", data, new String[]{email});
|
||||
} catch (Exception e) {
|
||||
// 如果HTML邮件发送失败,降级为文本邮件
|
||||
emailRecordService.sendEmail(title, content, email, tenantId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送简单通知邮件
|
||||
*
|
||||
* @param title 邮件标题
|
||||
* @param content 邮件内容
|
||||
* @param email 收件人邮箱
|
||||
* @param tenantId 租户ID
|
||||
*/
|
||||
public void sendNotificationEmail(String title, String content, String email, Integer tenantId) {
|
||||
sendNotificationEmail(title, content, email, tenantId, null, null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送带操作按钮的通知邮件
|
||||
*
|
||||
* @param title 邮件标题
|
||||
* @param content 邮件内容
|
||||
* @param email 收件人邮箱
|
||||
* @param tenantId 租户ID
|
||||
* @param actionUrl 操作链接
|
||||
* @param actionText 操作按钮文字
|
||||
*/
|
||||
public void sendNotificationEmailWithAction(String title, String content, String email, Integer tenantId,
|
||||
String actionUrl, String actionText) {
|
||||
sendNotificationEmail(title, content, email, tenantId, null, null, actionUrl, actionText);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送账户安全提醒邮件
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param phone 手机号
|
||||
* @param email 邮箱
|
||||
* @param tenantId 租户ID
|
||||
* @param event 安全事件描述
|
||||
*/
|
||||
public void sendSecurityAlertEmail(String username, String phone, String email, Integer tenantId, String event) {
|
||||
String title = "WebSoft账户安全提醒";
|
||||
String content = "您的账户发生了以下安全事件:" + event + "。如果这不是您本人的操作,请立即联系客服并修改密码。";
|
||||
String infoMessage = "为了保障您的账户安全,建议您定期修改密码并开启双重验证。";
|
||||
String actionUrl = "https://www.gxwebsoft.com/security";
|
||||
String actionText = "查看安全设置";
|
||||
|
||||
sendNotificationEmail(title, content, email, tenantId, "尊敬的用户", infoMessage, actionUrl, actionText);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送系统维护通知邮件
|
||||
*
|
||||
* @param email 收件人邮箱
|
||||
* @param tenantId 租户ID
|
||||
* @param maintenanceTime 维护时间
|
||||
* @param duration 维护时长
|
||||
*/
|
||||
public void sendMaintenanceNotificationEmail(String email, Integer tenantId, String maintenanceTime, String duration) {
|
||||
String title = "WebSoft系统维护通知";
|
||||
String content = "为了提供更好的服务,我们将在 " + maintenanceTime + " 进行系统维护,预计维护时长:" + duration + "。维护期间可能会影响系统的正常使用,给您带来的不便敬请谅解。";
|
||||
String infoMessage = "维护完成后,系统将自动恢复正常服务。";
|
||||
|
||||
sendNotificationEmail(title, content, email, tenantId, "尊敬的用户", infoMessage, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送订单状态变更邮件
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param orderNo 订单号
|
||||
* @param status 订单状态
|
||||
* @param email 邮箱
|
||||
* @param tenantId 租户ID
|
||||
*/
|
||||
public void sendOrderStatusEmail(String username, String orderNo, String status, String email, Integer tenantId) {
|
||||
String title = "WebSoft订单状态更新";
|
||||
String content = "您的订单 " + orderNo + " 状态已更新为:" + status + "。";
|
||||
String actionUrl = "https://www.gxwebsoft.com/orders/" + orderNo;
|
||||
String actionText = "查看订单详情";
|
||||
|
||||
sendNotificationEmailWithAction(title, content, email, tenantId, actionUrl, actionText);
|
||||
}
|
||||
}
|
||||
75
src/main/resources/email-templates.yml
Normal file
75
src/main/resources/email-templates.yml
Normal file
@@ -0,0 +1,75 @@
|
||||
# 邮件模板配置文件
|
||||
# 用于管理邮件模板的基本信息和品牌设置
|
||||
|
||||
email:
|
||||
templates:
|
||||
# 品牌信息
|
||||
brand:
|
||||
name: "WebSoft"
|
||||
company: "南宁网宿信息科技有限公司"
|
||||
description: "企业级数字化解决方案"
|
||||
website: "https://www.gxwebsoft.com"
|
||||
support_email: "170083662@qq.com"
|
||||
logo_url: "https://www.gxwebsoft.com/logo.png"
|
||||
|
||||
# 链接配置
|
||||
links:
|
||||
login: "https://www.gxwebsoft.com/login"
|
||||
help: "https://www.gxwebsoft.com/help"
|
||||
contact: "https://www.gxwebsoft.com/contact"
|
||||
security: "https://www.gxwebsoft.com/security"
|
||||
|
||||
# 模板列表
|
||||
templates:
|
||||
register-success:
|
||||
name: "注册成功邮件"
|
||||
description: "用户注册成功后发送的欢迎邮件"
|
||||
file: "register-success.html"
|
||||
subject: "恭喜!您的WebSoft账号已注册成功"
|
||||
|
||||
password-reset:
|
||||
name: "密码重置邮件"
|
||||
description: "用户密码重置后发送的通知邮件"
|
||||
file: "password-reset.html"
|
||||
subject: "WebSoft密码重置通知"
|
||||
|
||||
notification:
|
||||
name: "通用通知邮件"
|
||||
description: "系统通知、公告等通用邮件模板"
|
||||
file: "notification.html"
|
||||
subject: "WebSoft系统通知"
|
||||
|
||||
security-alert:
|
||||
name: "安全提醒邮件"
|
||||
description: "账户安全相关的提醒邮件"
|
||||
file: "notification.html"
|
||||
subject: "WebSoft账户安全提醒"
|
||||
|
||||
maintenance:
|
||||
name: "系统维护通知"
|
||||
description: "系统维护时发送的通知邮件"
|
||||
file: "notification.html"
|
||||
subject: "WebSoft系统维护通知"
|
||||
|
||||
order-status:
|
||||
name: "订单状态更新"
|
||||
description: "订单状态变更时发送的通知邮件"
|
||||
file: "notification.html"
|
||||
subject: "WebSoft订单状态更新"
|
||||
|
||||
# 邮件样式配置
|
||||
styles:
|
||||
primary_color: "#667eea"
|
||||
secondary_color: "#764ba2"
|
||||
success_color: "#4CAF50"
|
||||
warning_color: "#ffa502"
|
||||
danger_color: "#ff6b6b"
|
||||
info_color: "#4facfe"
|
||||
|
||||
# 邮件发送配置
|
||||
settings:
|
||||
retry_times: 3
|
||||
timeout: 30000
|
||||
fallback_to_text: true
|
||||
track_opens: true
|
||||
track_clicks: true
|
||||
260
src/main/resources/templates/notification.html
Normal file
260
src/main/resources/templates/notification.html
Normal file
@@ -0,0 +1,260 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>WebSoft通知</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.email-container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.header {
|
||||
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
||||
padding: 40px 30px;
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
.header-subtitle {
|
||||
font-size: 16px;
|
||||
opacity: 0.9;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.notification-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background-color: #00d2ff;
|
||||
border-radius: 50%;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 40px 30px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 24px;
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.message {
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
margin-bottom: 30px;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.notification-content {
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
padding: 25px;
|
||||
margin: 30px 0;
|
||||
border-left: 4px solid #4facfe;
|
||||
}
|
||||
|
||||
.notification-content h3 {
|
||||
color: #333;
|
||||
margin-bottom: 15px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.notification-body {
|
||||
color: #555;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.cta-section {
|
||||
text-align: center;
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.cta-button {
|
||||
display: inline-block;
|
||||
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
padding: 15px 40px;
|
||||
border-radius: 25px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
transition: transform 0.2s ease;
|
||||
box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
|
||||
}
|
||||
|
||||
.cta-button:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
|
||||
}
|
||||
|
||||
.info-box {
|
||||
background-color: #e3f2fd;
|
||||
border: 1px solid #bbdefb;
|
||||
border-radius: 6px;
|
||||
padding: 15px;
|
||||
margin: 20px 0;
|
||||
color: #1565c0;
|
||||
}
|
||||
|
||||
.info-box strong {
|
||||
color: #0d47a1;
|
||||
}
|
||||
|
||||
.footer {
|
||||
background-color: #2c3e50;
|
||||
color: #ecf0f1;
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.footer-content {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.footer-links {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.footer-links a {
|
||||
color: #3498db;
|
||||
text-decoration: none;
|
||||
margin: 0 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.footer-links a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
font-size: 12px;
|
||||
color: #95a5a6;
|
||||
margin-top: 20px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid #34495e;
|
||||
}
|
||||
|
||||
.timestamp {
|
||||
text-align: right;
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
margin-top: 20px;
|
||||
padding-top: 15px;
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.email-container {
|
||||
margin: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.header, .content, .footer {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="email-container">
|
||||
<!-- Header -->
|
||||
<div class="header">
|
||||
<div class="logo">WebSoft</div>
|
||||
<div class="header-subtitle">企业级数字化解决方案</div>
|
||||
<div class="notification-icon">📢</div>
|
||||
</div>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="content">
|
||||
<h1 class="title">${title!'系统通知'}</h1>
|
||||
<p class="message">
|
||||
${greeting!'您好!'}我们有一条重要通知需要告知您,请查看以下详细信息。
|
||||
</p>
|
||||
|
||||
<!-- Notification Content -->
|
||||
<div class="notification-content">
|
||||
<h3>📋 通知详情</h3>
|
||||
<div class="notification-body">
|
||||
${content!'这是一条系统通知消息。'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Box -->
|
||||
<% if(infoMessage!) { %>
|
||||
<div class="info-box">
|
||||
<strong>ℹ️ 温馨提示:</strong> ${infoMessage!}
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<!-- CTA Button -->
|
||||
<% if(actionUrl!) { %>
|
||||
<div class="cta-section">
|
||||
<a href="${actionUrl!}" class="cta-button">${actionText!'查看详情'}</a>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<!-- Timestamp -->
|
||||
<div class="timestamp">
|
||||
发送时间:${sendTime!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="footer">
|
||||
<div class="footer-content">
|
||||
<strong>南宁网宿信息科技有限公司</strong><br>
|
||||
专业的企业数字化转型服务商
|
||||
</div>
|
||||
|
||||
<div class="footer-links">
|
||||
<a href="https://www.gxwebsoft.com">官方网站</a>
|
||||
<a href="https://www.gxwebsoft.com/help">帮助中心</a>
|
||||
<a href="https://www.gxwebsoft.com/contact">联系我们</a>
|
||||
</div>
|
||||
|
||||
<div class="copyright">
|
||||
© 2024 南宁网宿信息科技有限公司 版权所有<br>
|
||||
如有疑问,请联系客服:170083662@qq.com
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
323
src/main/resources/templates/password-reset.html
Normal file
323
src/main/resources/templates/password-reset.html
Normal file
@@ -0,0 +1,323 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>WebSoft密码重置</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.email-container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.header {
|
||||
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
|
||||
padding: 40px 30px;
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
.header-subtitle {
|
||||
font-size: 16px;
|
||||
opacity: 0.9;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.warning-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background-color: #ffa502;
|
||||
border-radius: 50%;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 40px 30px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 24px;
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.message {
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
margin-bottom: 30px;
|
||||
text-align: center;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.reset-info {
|
||||
background-color: #fff5f5;
|
||||
border-radius: 8px;
|
||||
padding: 25px;
|
||||
margin: 30px 0;
|
||||
border-left: 4px solid #ff6b6b;
|
||||
}
|
||||
|
||||
.reset-info h3 {
|
||||
color: #333;
|
||||
margin-bottom: 15px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 0;
|
||||
border-bottom: 1px solid #fee;
|
||||
}
|
||||
|
||||
.info-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-weight: 600;
|
||||
color: #555;
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
color: #333;
|
||||
font-family: 'Courier New', monospace;
|
||||
background-color: #fff;
|
||||
padding: 5px 10px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.cta-section {
|
||||
text-align: center;
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.cta-button {
|
||||
display: inline-block;
|
||||
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
padding: 15px 40px;
|
||||
border-radius: 25px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
transition: transform 0.2s ease;
|
||||
box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
|
||||
}
|
||||
|
||||
.cta-button:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
|
||||
}
|
||||
|
||||
.security-tips {
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
padding: 25px;
|
||||
margin: 30px 0;
|
||||
}
|
||||
|
||||
.security-tips h3 {
|
||||
color: #333;
|
||||
margin-bottom: 15px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.security-tips ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.security-tips li {
|
||||
padding: 8px 0;
|
||||
color: #666;
|
||||
position: relative;
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
.security-tips li:before {
|
||||
content: "🔒";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.footer {
|
||||
background-color: #2c3e50;
|
||||
color: #ecf0f1;
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.footer-content {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.footer-links {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.footer-links a {
|
||||
color: #3498db;
|
||||
text-decoration: none;
|
||||
margin: 0 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.footer-links a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
font-size: 12px;
|
||||
color: #95a5a6;
|
||||
margin-top: 20px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid #34495e;
|
||||
}
|
||||
|
||||
.warning-notice {
|
||||
background-color: #fff3cd;
|
||||
border: 1px solid #ffeaa7;
|
||||
border-radius: 6px;
|
||||
padding: 15px;
|
||||
margin: 20px 0;
|
||||
color: #856404;
|
||||
}
|
||||
|
||||
.warning-notice strong {
|
||||
color: #533f03;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.email-container {
|
||||
margin: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.header, .content, .footer {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="email-container">
|
||||
<!-- Header -->
|
||||
<div class="header">
|
||||
<div class="logo">WebSoft</div>
|
||||
<div class="header-subtitle">企业级数字化解决方案</div>
|
||||
<div class="warning-icon">⚠️</div>
|
||||
</div>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="content">
|
||||
<h1 class="title">密码重置通知</h1>
|
||||
<p class="message">
|
||||
您好!我们收到了您的密码重置请求。为了保障您的账户安全,请查看以下信息。
|
||||
</p>
|
||||
|
||||
<!-- Reset Information -->
|
||||
<div class="reset-info">
|
||||
<h3>🔑 重置信息</h3>
|
||||
<div class="info-item">
|
||||
<span class="info-label">账号:</span>
|
||||
<span class="info-value">${username!}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">手机号:</span>
|
||||
<span class="info-value">${phone!}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">重置时间:</span>
|
||||
<span class="info-value">${resetTime!}</span>
|
||||
</div>
|
||||
<% if(newPassword!) { %>
|
||||
<div class="info-item">
|
||||
<span class="info-label">新密码:</span>
|
||||
<span class="info-value">${newPassword!}</span>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
<!-- Warning Notice -->
|
||||
<div class="warning-notice">
|
||||
<strong>⚠️ 重要提醒:</strong> 如果这不是您本人的操作,请立即联系客服并修改密码!
|
||||
</div>
|
||||
|
||||
<!-- CTA Button -->
|
||||
<div class="cta-section">
|
||||
<a href="https://www.gxwebsoft.com/login" class="cta-button">立即登录</a>
|
||||
</div>
|
||||
|
||||
<!-- Security Tips -->
|
||||
<div class="security-tips">
|
||||
<h3>🛡️ 安全建议</h3>
|
||||
<ul>
|
||||
<li>建议您立即登录并修改为更安全的密码</li>
|
||||
<li>密码应包含大小写字母、数字和特殊字符</li>
|
||||
<li>不要在多个网站使用相同的密码</li>
|
||||
<li>定期更换密码以保障账户安全</li>
|
||||
<li>如发现异常登录,请及时联系客服</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="footer">
|
||||
<div class="footer-content">
|
||||
<strong>南宁网宿信息科技有限公司</strong><br>
|
||||
专业的企业数字化转型服务商
|
||||
</div>
|
||||
|
||||
<div class="footer-links">
|
||||
<a href="https://www.gxwebsoft.com">官方网站</a>
|
||||
<a href="https://www.gxwebsoft.com/help">帮助中心</a>
|
||||
<a href="https://www.gxwebsoft.com/contact">联系我们</a>
|
||||
</div>
|
||||
|
||||
<div class="copyright">
|
||||
© 2024 南宁网宿信息科技有限公司 版权所有<br>
|
||||
如有疑问,请联系客服:170083662@qq.com
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
351
src/main/resources/templates/register-success.html
Normal file
351
src/main/resources/templates/register-success.html
Normal file
@@ -0,0 +1,351 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>WebSoft账号注册成功</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.email-container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.header {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
padding: 40px 30px;
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
.header-subtitle {
|
||||
font-size: 16px;
|
||||
opacity: 0.9;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.success-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background-color: #4CAF50;
|
||||
border-radius: 50%;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 40px 30px;
|
||||
}
|
||||
|
||||
.welcome-title {
|
||||
font-size: 24px;
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.welcome-message {
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
margin-bottom: 30px;
|
||||
text-align: center;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.account-info {
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
padding: 25px;
|
||||
margin: 30px 0;
|
||||
border-left: 4px solid #667eea;
|
||||
}
|
||||
|
||||
.account-info h3 {
|
||||
color: #333;
|
||||
margin-bottom: 15px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 0;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.info-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-weight: 600;
|
||||
color: #555;
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
color: #333;
|
||||
font-family: 'Courier New', monospace;
|
||||
background-color: #fff;
|
||||
padding: 5px 10px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.cta-section {
|
||||
text-align: center;
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.cta-button {
|
||||
display: inline-block;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
padding: 15px 40px;
|
||||
border-radius: 25px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
transition: transform 0.2s ease;
|
||||
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
|
||||
}
|
||||
|
||||
.cta-button:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
|
||||
}
|
||||
|
||||
.features {
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.features h3 {
|
||||
text-align: center;
|
||||
margin-bottom: 25px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.feature-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.feature-item {
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
font-size: 24px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.feature-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.feature-desc {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.footer {
|
||||
background-color: #2c3e50;
|
||||
color: #ecf0f1;
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.footer-content {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.footer-links {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.footer-links a {
|
||||
color: #3498db;
|
||||
text-decoration: none;
|
||||
margin: 0 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.footer-links a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
font-size: 12px;
|
||||
color: #95a5a6;
|
||||
margin-top: 20px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid #34495e;
|
||||
}
|
||||
|
||||
.security-notice {
|
||||
background-color: #fff3cd;
|
||||
border: 1px solid #ffeaa7;
|
||||
border-radius: 6px;
|
||||
padding: 15px;
|
||||
margin: 20px 0;
|
||||
color: #856404;
|
||||
}
|
||||
|
||||
.security-notice strong {
|
||||
color: #533f03;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.email-container {
|
||||
margin: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.header, .content, .footer {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.welcome-title {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.feature-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="email-container">
|
||||
<!-- Header -->
|
||||
<div class="header">
|
||||
<div class="logo">WebSoft</div>
|
||||
<div class="header-subtitle">企业级数字化解决方案</div>
|
||||
<div class="success-icon">✓</div>
|
||||
</div>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="content">
|
||||
<h1 class="welcome-title">恭喜!账号注册成功</h1>
|
||||
<p class="welcome-message">
|
||||
欢迎加入WebSoft大家庭!您的账号已成功创建,现在可以开始体验我们的企业级服务了。
|
||||
</p>
|
||||
|
||||
<!-- Account Information -->
|
||||
<div class="account-info">
|
||||
<h3>📋 您的账号信息</h3>
|
||||
<div class="info-item">
|
||||
<span class="info-label">用户名:</span>
|
||||
<span class="info-value">${username!}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">手机号:</span>
|
||||
<span class="info-value">${phone!}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">登录密码:</span>
|
||||
<span class="info-value">${password!}</span>
|
||||
</div>
|
||||
<% if(email!) { %>
|
||||
<div class="info-item">
|
||||
<span class="info-label">邮箱:</span>
|
||||
<span class="info-value">${email!}</span>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
<!-- Security Notice -->
|
||||
<div class="security-notice">
|
||||
<strong>🔒 安全提醒:</strong> 请妥善保管您的登录信息,建议首次登录后立即修改密码。
|
||||
</div>
|
||||
|
||||
<!-- CTA Button -->
|
||||
<div class="cta-section">
|
||||
<a href="https://www.gxwebsoft.com/login" class="cta-button">立即登录体验</a>
|
||||
</div>
|
||||
|
||||
<!-- Features -->
|
||||
<div class="features">
|
||||
<h3>🚀 开始探索WebSoft的强大功能</h3>
|
||||
<div class="feature-grid">
|
||||
<div class="feature-item">
|
||||
<div class="feature-icon">📊</div>
|
||||
<div class="feature-title">数据分析</div>
|
||||
<div class="feature-desc">智能数据洞察</div>
|
||||
</div>
|
||||
<div class="feature-item">
|
||||
<div class="feature-icon">🔧</div>
|
||||
<div class="feature-title">系统管理</div>
|
||||
<div class="feature-desc">高效运营管理</div>
|
||||
</div>
|
||||
<div class="feature-item">
|
||||
<div class="feature-icon">👥</div>
|
||||
<div class="feature-title">团队协作</div>
|
||||
<div class="feature-desc">无缝团队合作</div>
|
||||
</div>
|
||||
<div class="feature-item">
|
||||
<div class="feature-icon">🛡️</div>
|
||||
<div class="feature-title">安全保障</div>
|
||||
<div class="feature-desc">企业级安全</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="footer">
|
||||
<div class="footer-content">
|
||||
<strong>南宁网宿信息科技有限公司</strong><br>
|
||||
专业的企业数字化转型服务商
|
||||
</div>
|
||||
|
||||
<div class="footer-links">
|
||||
<a href="https://www.gxwebsoft.com">官方网站</a>
|
||||
<a href="https://www.gxwebsoft.com/help">帮助中心</a>
|
||||
<a href="https://www.gxwebsoft.com/contact">联系我们</a>
|
||||
</div>
|
||||
|
||||
<div class="copyright">
|
||||
© 2024 南宁网宿信息科技有限公司 版权所有<br>
|
||||
如有疑问,请联系客服:170083662@qq.com
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.gxwebsoft;
|
||||
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.utils.DomainUtil;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import static com.gxwebsoft.common.core.constants.DomainConstants.DOMAIN;
|
||||
|
||||
/**
|
||||
* Created by WebSoft on 2020-03-23 23:37
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user