mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-15 04:15:56 +08:00
feat: add application title
This commit is contained in:
parent
360fbeb108
commit
d89034d913
@ -38,6 +38,7 @@ class LicenseModel(BaseModel):
|
|||||||
|
|
||||||
class BrandingModel(BaseModel):
|
class BrandingModel(BaseModel):
|
||||||
enabled: bool = False
|
enabled: bool = False
|
||||||
|
application_title: str = ""
|
||||||
login_page_logo: str = ""
|
login_page_logo: str = ""
|
||||||
workspace_logo: str = ""
|
workspace_logo: str = ""
|
||||||
favicon: str = ""
|
favicon: str = ""
|
||||||
|
@ -7,6 +7,7 @@ from flask import render_template
|
|||||||
|
|
||||||
from configs import dify_config
|
from configs import dify_config
|
||||||
from extensions.ext_mail import mail
|
from extensions.ext_mail import mail
|
||||||
|
from services.feature_service import FeatureService
|
||||||
|
|
||||||
|
|
||||||
@shared_task(queue="mail")
|
@shared_task(queue="mail")
|
||||||
@ -28,14 +29,16 @@ def send_email_code_login_mail_task(language: str, to: str, code: str):
|
|||||||
if language == "zh-Hans":
|
if language == "zh-Hans":
|
||||||
template = "email_code_login_mail_template_zh-CN.html"
|
template = "email_code_login_mail_template_zh-CN.html"
|
||||||
if dify_config.ENTERPRISE_ENABLED:
|
if dify_config.ENTERPRISE_ENABLED:
|
||||||
|
application_title = FeatureService.get_system_features().get("application_title", "Dify")
|
||||||
template = "without-brand/email_code_login_mail_template_zh-CN_enterprise.html"
|
template = "without-brand/email_code_login_mail_template_zh-CN_enterprise.html"
|
||||||
html_content = render_template(template, to=to, code=code)
|
html_content = render_template(template, to=to, code=code, application_title=application_title)
|
||||||
mail.send(to=to, subject="邮箱验证码", html=html_content)
|
mail.send(to=to, subject="邮箱验证码", html=html_content)
|
||||||
else:
|
else:
|
||||||
template = "email_code_login_mail_template_en-US.html"
|
template = "email_code_login_mail_template_en-US.html"
|
||||||
if dify_config.ENTERPRISE_ENABLED:
|
if dify_config.ENTERPRISE_ENABLED:
|
||||||
|
application_title = FeatureService.get_system_features().get("application_title", "Dify")
|
||||||
template = "without-brand/email_code_login_mail_template_en-US_enterprise.html"
|
template = "without-brand/email_code_login_mail_template_en-US_enterprise.html"
|
||||||
html_content = render_template(template, to=to, code=code)
|
html_content = render_template(template, to=to, code=code, application_title=application_title)
|
||||||
mail.send(to=to, subject="Email Code", html=html_content)
|
mail.send(to=to, subject="Email Code", html=html_content)
|
||||||
|
|
||||||
end_at = time.perf_counter()
|
end_at = time.perf_counter()
|
||||||
|
@ -7,6 +7,7 @@ from flask import render_template
|
|||||||
|
|
||||||
from configs import dify_config
|
from configs import dify_config
|
||||||
from extensions.ext_mail import mail
|
from extensions.ext_mail import mail
|
||||||
|
from services.feature_service import FeatureService
|
||||||
|
|
||||||
|
|
||||||
@shared_task(queue="mail")
|
@shared_task(queue="mail")
|
||||||
@ -35,6 +36,7 @@ def send_invite_member_mail_task(language: str, to: str, token: str, inviter_nam
|
|||||||
if language == "zh-Hans":
|
if language == "zh-Hans":
|
||||||
template = "invite_member_mail_template_zh-CN.html"
|
template = "invite_member_mail_template_zh-CN.html"
|
||||||
if dify_config.ENTERPRISE_ENABLED:
|
if dify_config.ENTERPRISE_ENABLED:
|
||||||
|
application_title = FeatureService.get_system_features().get("application_title", "Dify")
|
||||||
template = "without-brand/invite_member_mail_template_zh-CN.html"
|
template = "without-brand/invite_member_mail_template_zh-CN.html"
|
||||||
html_content = render_template(
|
html_content = render_template(
|
||||||
template,
|
template,
|
||||||
@ -42,11 +44,13 @@ def send_invite_member_mail_task(language: str, to: str, token: str, inviter_nam
|
|||||||
inviter_name=inviter_name,
|
inviter_name=inviter_name,
|
||||||
workspace_name=workspace_name,
|
workspace_name=workspace_name,
|
||||||
url=url,
|
url=url,
|
||||||
|
application_title=application_title,
|
||||||
)
|
)
|
||||||
mail.send(to=to, subject="立即加入 Dify 工作空间", html=html_content)
|
mail.send(to=to, subject="立即加入 Dify 工作空间", html=html_content)
|
||||||
else:
|
else:
|
||||||
template = "invite_member_mail_template_en-US.html"
|
template = "invite_member_mail_template_en-US.html"
|
||||||
if dify_config.ENTERPRISE_ENABLED:
|
if dify_config.ENTERPRISE_ENABLED:
|
||||||
|
application_title = FeatureService.get_system_features().get("application_title", "Dify")
|
||||||
template = "without-brand/invite_member_mail_template_en-US.html"
|
template = "without-brand/invite_member_mail_template_en-US.html"
|
||||||
html_content = render_template(
|
html_content = render_template(
|
||||||
template,
|
template,
|
||||||
@ -54,6 +58,7 @@ def send_invite_member_mail_task(language: str, to: str, token: str, inviter_nam
|
|||||||
inviter_name=inviter_name,
|
inviter_name=inviter_name,
|
||||||
workspace_name=workspace_name,
|
workspace_name=workspace_name,
|
||||||
url=url,
|
url=url,
|
||||||
|
application_title=application_title,
|
||||||
)
|
)
|
||||||
mail.send(to=to, subject="Join Dify Workspace Now", html=html_content)
|
mail.send(to=to, subject="Join Dify Workspace Now", html=html_content)
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ from flask import render_template
|
|||||||
|
|
||||||
from configs import dify_config
|
from configs import dify_config
|
||||||
from extensions.ext_mail import mail
|
from extensions.ext_mail import mail
|
||||||
|
from services.feature_service import FeatureService
|
||||||
|
|
||||||
|
|
||||||
@shared_task(queue="mail")
|
@shared_task(queue="mail")
|
||||||
@ -28,14 +29,16 @@ def send_reset_password_mail_task(language: str, to: str, code: str):
|
|||||||
if language == "zh-Hans":
|
if language == "zh-Hans":
|
||||||
template = "reset_password_mail_template_zh-CN.html"
|
template = "reset_password_mail_template_zh-CN.html"
|
||||||
if dify_config.ENTERPRISE_ENABLED:
|
if dify_config.ENTERPRISE_ENABLED:
|
||||||
|
application_title = FeatureService.get_system_features().get("application_title", "Dify")
|
||||||
template = "without-brand/reset_password_mail_template_zh-CN.html"
|
template = "without-brand/reset_password_mail_template_zh-CN.html"
|
||||||
html_content = render_template(template, to=to, code=code)
|
html_content = render_template(template, to=to, code=code, application_title=application_title)
|
||||||
mail.send(to=to, subject="设置您的 Dify 密码", html=html_content)
|
mail.send(to=to, subject="设置您的 Dify 密码", html=html_content)
|
||||||
else:
|
else:
|
||||||
template = "reset_password_mail_template_en-US.html"
|
template = "reset_password_mail_template_en-US.html"
|
||||||
if dify_config.ENTERPRISE_ENABLED:
|
if dify_config.ENTERPRISE_ENABLED:
|
||||||
|
application_title = FeatureService.get_system_features().get("application_title", "Dify")
|
||||||
template = "without-brand/reset_password_mail_template_en-US.html"
|
template = "without-brand/reset_password_mail_template_en-US.html"
|
||||||
html_content = render_template(template, to=to, code=code)
|
html_content = render_template(template, to=to, code=code, application_title=application_title)
|
||||||
mail.send(to=to, subject="Set Your Dify Password", html=html_content)
|
mail.send(to=to, subject="Set Your Dify Password", html=html_content)
|
||||||
|
|
||||||
end_at = time.perf_counter()
|
end_at = time.perf_counter()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user