新增:新增修改邮箱功能,并优化部分以往代码(引入 spring-boot-starter-mail 用于发送邮件验证码)

This commit is contained in:
2023-01-14 01:05:39 +08:00
parent 73fadb8315
commit 8b82557883
45 changed files with 1318 additions and 280 deletions

View File

@@ -69,6 +69,48 @@ spring:
# 是否开启 SSL
ssl: false
--- ### 邮件配置
spring:
mail:
# 根据需要更换
host: smtp.126.com
port: 465
username: 你的邮箱
password: 你的邮箱授权码
default-encoding: utf-8
properties:
mail:
smtp:
auth: true
socketFactory:
class: javax.net.ssl.SSLSocketFactory
port: 465
--- ### 验证码配置
captcha:
## 图片验证码配置
image:
# 类型
type: SPEC
# 内容长度
length: 4
# 过期时间
expirationInMinutes: 2
# 宽度
width: 111
# 高度
height: 36
## 邮箱验证码配置
mail:
# 内容长度
length: 6
# 过期时间
expirationInMinutes: 5
# 限制时间
limitInSeconds: 60
# 模板路径
templatePath: mail/captcha.ftl
--- ### 安全配置
security:
# 排除路径配置
@@ -95,21 +137,6 @@ rsa:
# 私钥
privateKey: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAznV2Bi0zIX61NC3zSx8U6lJXbtru325pRV4Wt0aJXGxy6LMTsfxIye1ip+f2WnxrkYfk/X8YZ6FWNQPaAX/iRwIDAQABAkEAk/VcAusrpIqA5Ac2P5Tj0VX3cOuXmyouaVcXonr7f+6y2YTjLQuAnkcfKKocQI/juIRQBFQIqqW/m1nmz1wGeQIhAO8XaA/KxzOIgU0l/4lm0A2Wne6RokJ9HLs1YpOzIUmVAiEA3Q9DQrpAlIuiT1yWAGSxA9RxcjUM/1kdVLTkv0avXWsCIE0X8woEjK7lOSwzMG6RpEx9YHdopjViOj1zPVH61KTxAiBmv/dlhqkJ4rV46fIXELZur0pj6WC3N7a4brR8a+CLLQIhAMQyerWl2cPNVtE/8tkziHKbwW3ZUiBXU24wFxedT9iV
--- ### 验证码配置
captcha:
# 类型
type: SPEC
# 缓存键的前缀
keyPrefix: CAPTCHA
# 过期时间
expirationInMinutes: 2
# 内容长度
length: 4
# 宽度
width: 111
# 高度
height: 36
--- ### 接口文档配置
springdoc:
swagger-ui:

View File

@@ -69,6 +69,48 @@ spring:
# 是否开启 SSL
ssl: false
--- ### 邮件配置
spring:
mail:
# 根据需要更换
host: smtp.126.com
port: 465
username: 你的邮箱
password: 你的邮箱授权码
default-encoding: utf-8
properties:
mail:
smtp:
auth: true
socketFactory:
class: javax.net.ssl.SSLSocketFactory
port: 465
--- ### 验证码配置
captcha:
## 图片验证码配置
image:
# 类型
type: SPEC
# 内容长度
length: 4
# 过期时间
expirationInMinutes: 2
# 宽度
width: 111
# 高度
height: 36
## 邮箱验证码配置
mail:
# 内容长度
length: 6
# 过期时间
expirationInMinutes: 5
# 限制时间
limitInSeconds: 60
# 模板路径
templatePath: mail/captcha.ftl
--- ### 安全配置
security:
# 排除路径配置
@@ -88,21 +130,6 @@ rsa:
# 私钥
privateKey: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAznV2Bi0zIX61NC3zSx8U6lJXbtru325pRV4Wt0aJXGxy6LMTsfxIye1ip+f2WnxrkYfk/X8YZ6FWNQPaAX/iRwIDAQABAkEAk/VcAusrpIqA5Ac2P5Tj0VX3cOuXmyouaVcXonr7f+6y2YTjLQuAnkcfKKocQI/juIRQBFQIqqW/m1nmz1wGeQIhAO8XaA/KxzOIgU0l/4lm0A2Wne6RokJ9HLs1YpOzIUmVAiEA3Q9DQrpAlIuiT1yWAGSxA9RxcjUM/1kdVLTkv0avXWsCIE0X8woEjK7lOSwzMG6RpEx9YHdopjViOj1zPVH61KTxAiBmv/dlhqkJ4rV46fIXELZur0pj6WC3N7a4brR8a+CLLQIhAMQyerWl2cPNVtE/8tkziHKbwW3ZUiBXU24wFxedT9iV
--- ### 验证码配置
captcha:
# 类型
type: SPEC
# 缓存键的前缀
keyPrefix: CAPTCHA
# 过期时间
expirationInMinutes: 2
# 内容长度
length: 4
# 宽度
width: 111
# 高度
height: 36
--- ### 接口文档配置
springdoc:
swagger-ui:

View File

@@ -1,13 +1,13 @@
--- ### 项目配置
continew-admin:
# 名称
name: ContiNew-Admin
name: ContiNew Admin
# 应用名称
appName: continew-admin
# 版本
version: 0.0.1-SNAPSHOT
# 描述
description: ContiNew-Admin (incubating) 中后台管理框架Continue New Admin持续以最新流行技术栈构建。
description: ContiNew Admin 中后台管理框架(孵化中)Continue New Admin持续以最新流行技术栈构建。
# URL
url: https://github.com/Charles7c/continew-admin
## 作者信息配置
@@ -65,7 +65,7 @@ knife4j:
# 是否自定义 footer默认 false 非自定义)
enable-footer-custom: true
# 自定义 footer 内容,支持 Markdown 语法
footer-custom-content: '[Apache-2.0](https://github.com/Charles7c/continew-admin/blob/dev/LICENSE) | Copyright © 2022-present [ContiNew-Admin](https://github.com/Charles7c/continew-admin)'
footer-custom-content: 'Copyright © 2022-present Charles7c ⋅ [ContiNew Admin](https://github.com/Charles7c/continew-admin)'
--- ### Sa-Token 配置
sa-token:

View File

@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="description" content="邮箱验证码">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<base target="_blank">
<style>::-webkit-scrollbar{ display: none; }</style>
</head>
<body tabindex="0">
<div style="background-color: #ECECEC; padding: 25px;">
<div style="margin: 0 auto; text-align: left; position: relative; border-radius: 5px; border-collapse: collapse; box-shadow: rgb(153, 153, 153) 0px 0px 5px; background: #fff; font-family: 微软雅黑, 黑体, sans-serif; font-size: 14px; line-height: 1.5;">
<div style="height: 29px; line-height: 25px; padding: 15px 30px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #307AF2; background: #00308f; border-radius: 5px 5px 0 0;">
<div style="font-size: 24px; font-weight: bolder; color: #fff; display: inline-flex; align-items: center;">
<a href="https://cnadmin.charles7c.top/">
<img src="https://cnadmin.charles7c.top/logo.svg" alt="ContiNew Admin" style="vertical-align: middle;">
</a>
<a href="https://cnadmin.charles7c.top/" style="margin-left: 4px; text-decoration: none; color: #fff;">ContiNew Admin</a>
</div>
</div>
<div style="word-break: break-word;">
<div style="border-radius: 5px; padding: 25px 30px 11px; background-color: #fff; opacity: 0.8;">
<h2 style="margin: 5px 0; font-size: 18px; line-height: 22px; color: #333;">亲爱的用户:</h2>
<p>
您好!感谢您使用 <a href="https://github.com/Charles7c/continew-admin" style="color: #333;">ContiNew Admin</a>,本次请求的验证码为:<span style="font-size: 16px; color: #ff8c00;">${captcha}</span>,请在 ${expiration} 分钟内使用此验证码完成验证。
</p>
<br>
<h2 style="margin: 5px 0; font-size: 18px; line-height: 22px; color: #333;">Dear user:</h2>
<p>
Hello! Thanks for using ContiNew Admin, The verification code for this request is:&nbsp;<span style="font-size: 16px; color: #ff8c00;">${captcha}</span>, please use this verification code to complete the verification within ${expiration} minutes.
</p>
<div style="width: 100%; margin: 0 auto;">
<div style="padding: 10px 10px 0; border-top: 1px solid #ccc; color: #747474; margin-bottom: 20px; line-height: 1.3em; font-size: 12px;">
<p>
若非本人操作,请忽略此邮件。此邮件由系统自动发送,请勿直接回复该邮件。<br>
Please ignore this email if not by yourself. This email is sent automatically by the system, please do not reply to this email directly.
</p>
<p>Copyright © 2022-present Charles7c</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>