feat: add branding support

This commit is contained in:
GareArc
2025-03-11 07:14:52 -04:00
parent 0856792a57
commit fdb1e649d4
5 changed files with 50 additions and 6 deletions

View File

@@ -5,6 +5,7 @@ import click
from celery import shared_task # type: ignore
from flask import render_template
from configs import dify_config
from extensions.ext_mail import mail
@@ -25,10 +26,16 @@ def send_email_code_login_mail_task(language: str, to: str, code: str):
# send email code login mail using different languages
try:
if language == "zh-Hans":
html_content = render_template("email_code_login_mail_template_zh-CN.html", to=to, code=code)
template = "email_code_login_mail_template_zh-CN.html"
if dify_config.ENTERPRISE_ENABLED:
template = "without-brand/email_code_login_mail_template_zh-CN_enterprise.html"
html_content = render_template(template, to=to, code=code)
mail.send(to=to, subject="邮箱验证码", html=html_content)
else:
html_content = render_template("email_code_login_mail_template_en-US.html", to=to, code=code)
template = "email_code_login_mail_template_en-US.html"
if dify_config.ENTERPRISE_ENABLED:
template = "without-brand/email_code_login_mail_template_en-US_enterprise.html"
html_content = render_template(template, to=to, code=code)
mail.send(to=to, subject="Email Code", html=html_content)
end_at = time.perf_counter()