fix: 1052009

--bug=1052009 --user=王孝刚 [国际化]修改密码的验证码通知邮件未国际化 https://www.tapd.cn/57709429/s/1651094
This commit is contained in:
wxg0103 2025-02-06 16:04:37 +08:00 committed by wxg
parent fec705fe67
commit 1db5696bc1
7 changed files with 254 additions and 8 deletions

View File

@ -0,0 +1,122 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="email code" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<!--邮箱验证码模板-->
<body>
<div style="background-color: #ececec; padding: 35px">
<table
cellpadding="0"
style="
width: 800px;
height: 100%;
margin: 0px auto;
text-align: left;
position: relative;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
font-size: 14px;
line-height: 1.5;
box-shadow: rgb(153, 153, 153) 0px 0px 5px;
border-collapse: collapse;
background-position: initial initial;
background-repeat: initial initial;
background: #fff;
"
>
<tbody>
<tr>
<th
valign="middle"
style="
background: linear-gradient(
90deg,
#ebf1ff 24.34%,
#e5fbf8 56.18%,
#f2ebfe 90.18%
);
height: 25px;
line-height: 25px;
padding: 15px 35px;
border-bottom-width: 1px;
border-bottom-color: rgba(51, 112, 255);
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
"
>
<div
style="
width: 230px;
background: linear-gradient(180deg, #3370FF 0%, #7f3bf5 100%);
-webkit-background-clip: text;
font-size: 24px;
-webkit-text-fill-color: transparent;
font-style: normal;
font-weight: 900;
color: #1f2329;
"
>
Intelligent Knowledge Q&A System
</div>
</th>
</tr>
<tr>
<td style="word-break: break-all">
<div
style="
padding: 25px 35px 40px;
background-color: #fff;
opacity: 0.8;
"
>
<h2 style="margin: 5px 0px">
<font color="#333333" style="line-height: 20px">
<font style="line-height: 22px" size="4">
Dear user:</font
>
</font>
</h2>
<!-- 中文 -->
<p>
<font color="#ff8c00" style="font-weight: 900">${code}</font
>&nbsp;&nbsp;This is your dynamic verification code. Please fill it in within 30 minutes. To protect the security of your account, please do not provide this verification code to anyone.
</p>
<br />
<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;
text-align: right;
"
>
<p>Intelligent knowledge base project team</p>
<br />
<p>
Please do not reply to this system email<br />
</p>
<!--<p>©***</p>-->
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>

View File

@ -107,7 +107,6 @@
<br />
<p>
此为系统邮件,请勿回复<br />
Please do not reply to this system email
</p>
<!--<p>©***</p>-->
</div>

View File

@ -0,0 +1,123 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="email code" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<!--邮箱验证码模板-->
<body>
<div style="background-color: #ececec; padding: 35px">
<table
cellpadding="0"
style="
width: 800px;
height: 100%;
margin: 0px auto;
text-align: left;
position: relative;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
font-size: 14px;
line-height: 1.5;
box-shadow: rgb(153, 153, 153) 0px 0px 5px;
border-collapse: collapse;
background-position: initial initial;
background-repeat: initial initial;
background: #fff;
"
>
<tbody>
<tr>
<th
valign="middle"
style="
background: linear-gradient(
90deg,
#ebf1ff 24.34%,
#e5fbf8 56.18%,
#f2ebfe 90.18%
);
height: 25px;
line-height: 25px;
padding: 15px 35px;
border-bottom-width: 1px;
border-bottom-color: rgba(51, 112, 255);
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
"
>
<div
style="
width: 230px;
background: linear-gradient(180deg, #3370FF 0%, #7f3bf5 100%);
-webkit-background-clip: text;
font-size: 24px;
-webkit-text-fill-color: transparent;
font-style: normal;
font-weight: 900;
color: #1f2329;
"
>
智慧知識庫問答系統
</div>
</th>
</tr>
<tr>
<td style="word-break: break-all">
<div
style="
padding: 25px 35px 40px;
background-color: #fff;
opacity: 0.8;
"
>
<h2 style="margin: 5px 0px">
<font color="#333333" style="line-height: 20px">
<font style="line-height: 22px" size="4">
尊敬的用戶:</font
>
</font>
</h2>
<!-- 中文 -->
<p>
<font color="#ff8c00" style="font-weight: 900">${code}</font
>&nbsp;&nbsp;為您的動態驗證碼請於30分鐘內填寫為保障帳戶安全請勿向任何人提供此驗證碼。
</p>
<br />
<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;
text-align: right;
"
>
<p>智慧知識庫專案組</p>
<br />
<p>
此為系統郵件,請勿回覆<br />
</p>
<!--<p>©***</p>-->
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>

View File

@ -249,7 +249,7 @@ class DocumentSerializers(ApiMixin, serializers.Serializer):
return HttpResponse(content, status=200, headers={'Content-Type': 'text/cxv',
'Content-Disposition': 'attachment; filename="csv_template.csv"'})
elif self.data.get('type') == 'excel':
file = open(os.path.join(PROJECT_DIR, "apps", "dataset", 'template', f'csv_template_{to_locale(language)}.xlsx'), "rb")
file = open(os.path.join(PROJECT_DIR, "apps", "dataset", 'template', f'excel_template_{to_locale(language)}.xlsx'), "rb")
content = file.read()
file.close()
return HttpResponse(content, status=200, headers={'Content-Type': 'application/vnd.ms-excel',

View File

@ -4981,7 +4981,7 @@ msgstr ""
#: .\apps\setting\models_provider\impl\volcanic_engine_model_provider\volcanic_engine_model_provider.py:115
msgid "volcano engine"
msgstr "Volcano Engine"
msgstr "Volcengine"
#: .\apps\setting\models_provider\impl\wenxin_model_provider\credential\llm.py:50
#, python-brace-format

View File

@ -3698,7 +3698,7 @@ msgstr "语音合成"
#: .\apps\setting\models_provider\base_model_provider.py:156
msgid "Vision Model"
msgstr "图片理解"
msgstr "视觉模型"
#: .\apps\setting\models_provider\base_model_provider.py:157
msgid "Image Generation"

View File

@ -39,8 +39,8 @@ from function_lib.models.function import FunctionLib
from setting.models import Team, SystemSetting, SettingType, Model, TeamMember, TeamMemberPermission
from smartdoc.conf import PROJECT_DIR
from users.models.user import User, password_encrypt, get_user_dynamics_permission
from django.utils.translation import gettext_lazy as _
from django.utils.translation import gettext_lazy as _, gettext, to_locale
from django.utils.translation import get_language
user_cache = cache.caches['user_cache']
@ -393,8 +393,10 @@ class SendEmailSerializer(ApiMixin, serializers.Serializer):
code = "".join(list(map(lambda i: random.choice(['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'
]), range(6))))
# 获取邮件模板
file = open(os.path.join(PROJECT_DIR, "apps", "common", 'template', 'email_template.html'), "r",
encoding='utf-8')
language = get_language()
file = open(
os.path.join(PROJECT_DIR, "apps", "common", 'template', f'email_template{to_locale(language)}.html'), "r",
encoding='utf-8')
content = file.read()
file.close()
code_cache_key = email + ":" + state