mirror of https://github.com/langgenius/dify.git
Merge branch 'e-0154' into deploy/enterprise
This commit is contained in:
commit
abc625bcce
|
@ -100,6 +100,7 @@ class FeatureService:
|
||||||
|
|
||||||
if dify_config.ENTERPRISE_ENABLED:
|
if dify_config.ENTERPRISE_ENABLED:
|
||||||
system_features.enable_web_sso_switch_component = True
|
system_features.enable_web_sso_switch_component = True
|
||||||
|
system_features.branding.enabled = True
|
||||||
cls._fulfill_params_from_enterprise(system_features)
|
cls._fulfill_params_from_enterprise(system_features)
|
||||||
|
|
||||||
return system_features
|
return system_features
|
||||||
|
@ -188,7 +189,6 @@ class FeatureService:
|
||||||
features.is_allow_create_workspace = enterprise_info["IsAllowCreateWorkspace"]
|
features.is_allow_create_workspace = enterprise_info["IsAllowCreateWorkspace"]
|
||||||
|
|
||||||
if "Branding" in enterprise_info:
|
if "Branding" in enterprise_info:
|
||||||
features.branding.enabled = enterprise_info["Branding"].get("enabled", False)
|
|
||||||
features.branding.application_title = enterprise_info["Branding"].get("applicationTitle", "")
|
features.branding.application_title = enterprise_info["Branding"].get("applicationTitle", "")
|
||||||
features.branding.login_page_logo = enterprise_info["Branding"].get("loginPageLogo", "")
|
features.branding.login_page_logo = enterprise_info["Branding"].get("loginPageLogo", "")
|
||||||
features.branding.workspace_logo = enterprise_info["Branding"].get("workspaceLogo", "")
|
features.branding.workspace_logo = enterprise_info["Branding"].get("workspaceLogo", "")
|
||||||
|
@ -202,11 +202,3 @@ class FeatureService:
|
||||||
|
|
||||||
if "expired_at" in license_info:
|
if "expired_at" in license_info:
|
||||||
features.license.expired_at = license_info["expiredAt"]
|
features.license.expired_at = license_info["expiredAt"]
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def get_enterprise_application_title(cls):
|
|
||||||
branding = cls.get_system_features().branding
|
|
||||||
application_title = "Dify"
|
|
||||||
if branding.enabled:
|
|
||||||
application_title = branding.application_title
|
|
||||||
return application_title
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import click
|
||||||
from celery import shared_task # type: ignore
|
from celery import shared_task # type: ignore
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
|
|
||||||
from configs import dify_config
|
|
||||||
from extensions.ext_mail import mail
|
from extensions.ext_mail import mail
|
||||||
from services.feature_service import FeatureService
|
from services.feature_service import FeatureService
|
||||||
|
|
||||||
|
@ -28,8 +27,9 @@ def send_email_code_login_mail_task(language: str, to: str, code: str):
|
||||||
try:
|
try:
|
||||||
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:
|
system_features = FeatureService.get_system_features()
|
||||||
application_title = FeatureService.get_enterprise_application_title()
|
if system_features.branding.enabled:
|
||||||
|
application_title = system_features.branding.application_title
|
||||||
template = "without-brand/email_code_login_mail_template_zh-CN.html"
|
template = "without-brand/email_code_login_mail_template_zh-CN.html"
|
||||||
html_content = render_template(template, to=to, code=code, application_title=application_title)
|
html_content = render_template(template, to=to, code=code, application_title=application_title)
|
||||||
else:
|
else:
|
||||||
|
@ -37,8 +37,9 @@ def send_email_code_login_mail_task(language: str, to: str, code: str):
|
||||||
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:
|
system_features = FeatureService.get_system_features()
|
||||||
application_title = FeatureService.get_enterprise_application_title()
|
if system_features.branding.enabled:
|
||||||
|
application_title = system_features.branding.application_title
|
||||||
template = "without-brand/email_code_login_mail_template_en-US.html"
|
template = "without-brand/email_code_login_mail_template_en-US.html"
|
||||||
html_content = render_template(template, to=to, code=code, application_title=application_title)
|
html_content = render_template(template, to=to, code=code, application_title=application_title)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -35,8 +35,9 @@ def send_invite_member_mail_task(language: str, to: str, token: str, inviter_nam
|
||||||
url = f"{dify_config.CONSOLE_WEB_URL}/activate?token={token}"
|
url = f"{dify_config.CONSOLE_WEB_URL}/activate?token={token}"
|
||||||
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:
|
system_features = FeatureService.get_system_features()
|
||||||
application_title = FeatureService.get_enterprise_application_title()
|
if system_features.branding.enabled:
|
||||||
|
application_title = system_features.branding.application_title
|
||||||
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,
|
||||||
|
@ -54,8 +55,9 @@ def send_invite_member_mail_task(language: str, to: str, token: str, inviter_nam
|
||||||
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:
|
system_features = FeatureService.get_system_features()
|
||||||
application_title = FeatureService.get_enterprise_application_title()
|
if system_features.branding.enabled:
|
||||||
|
application_title = system_features.branding.application_title
|
||||||
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,
|
||||||
|
|
|
@ -5,7 +5,6 @@ import click
|
||||||
from celery import shared_task # type: ignore
|
from celery import shared_task # type: ignore
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
|
|
||||||
from configs import dify_config
|
|
||||||
from extensions.ext_mail import mail
|
from extensions.ext_mail import mail
|
||||||
from services.feature_service import FeatureService
|
from services.feature_service import FeatureService
|
||||||
|
|
||||||
|
@ -28,8 +27,9 @@ def send_reset_password_mail_task(language: str, to: str, code: str):
|
||||||
try:
|
try:
|
||||||
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:
|
system_features = FeatureService.get_system_features()
|
||||||
application_title = FeatureService.get_enterprise_application_title()
|
if system_features.branding.enabled:
|
||||||
|
application_title = system_features.branding.application_title
|
||||||
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, application_title=application_title)
|
html_content = render_template(template, to=to, code=code, application_title=application_title)
|
||||||
mail.send(to=to, subject=f"设置您的 {application_title} 密码", html=html_content)
|
mail.send(to=to, subject=f"设置您的 {application_title} 密码", html=html_content)
|
||||||
|
@ -38,8 +38,9 @@ def send_reset_password_mail_task(language: str, to: str, code: str):
|
||||||
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:
|
system_features = FeatureService.get_system_features()
|
||||||
application_title = FeatureService.get_enterprise_application_title()
|
if system_features.branding.enabled:
|
||||||
|
application_title = system_features.branding.application_title
|
||||||
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, application_title=application_title)
|
html_content = render_template(template, to=to, code=code, application_title=application_title)
|
||||||
mail.send(to=to, subject=f"Set Your {application_title} Password", html=html_content)
|
mail.send(to=to, subject=f"Set Your {application_title} Password", html=html_content)
|
||||||
|
|
Loading…
Reference in New Issue