mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-11 03:46:52 +08:00
chore(api/tasks): apply ruff reformatting (#7594)
This commit is contained in:
@@ -9,7 +9,7 @@ from configs import dify_config
|
||||
from extensions.ext_mail import mail
|
||||
|
||||
|
||||
@shared_task(queue='mail')
|
||||
@shared_task(queue="mail")
|
||||
def send_reset_password_mail_task(language: str, to: str, token: str):
|
||||
"""
|
||||
Async Send reset password mail
|
||||
@@ -20,26 +20,24 @@ def send_reset_password_mail_task(language: str, to: str, token: str):
|
||||
if not mail.is_inited():
|
||||
return
|
||||
|
||||
logging.info(click.style('Start password reset mail to {}'.format(to), fg='green'))
|
||||
logging.info(click.style("Start password reset mail to {}".format(to), fg="green"))
|
||||
start_at = time.perf_counter()
|
||||
|
||||
# send reset password mail using different languages
|
||||
try:
|
||||
url = f'{dify_config.CONSOLE_WEB_URL}/forgot-password?token={token}'
|
||||
if language == 'zh-Hans':
|
||||
html_content = render_template('reset_password_mail_template_zh-CN.html',
|
||||
to=to,
|
||||
url=url)
|
||||
url = f"{dify_config.CONSOLE_WEB_URL}/forgot-password?token={token}"
|
||||
if language == "zh-Hans":
|
||||
html_content = render_template("reset_password_mail_template_zh-CN.html", to=to, url=url)
|
||||
mail.send(to=to, subject="重置您的 Dify 密码", html=html_content)
|
||||
else:
|
||||
html_content = render_template('reset_password_mail_template_en-US.html',
|
||||
to=to,
|
||||
url=url)
|
||||
html_content = render_template("reset_password_mail_template_en-US.html", to=to, url=url)
|
||||
mail.send(to=to, subject="Reset Your Dify Password", html=html_content)
|
||||
|
||||
end_at = time.perf_counter()
|
||||
logging.info(
|
||||
click.style('Send password reset mail to {} succeeded: latency: {}'.format(to, end_at - start_at),
|
||||
fg='green'))
|
||||
click.style(
|
||||
"Send password reset mail to {} succeeded: latency: {}".format(to, end_at - start_at), fg="green"
|
||||
)
|
||||
)
|
||||
except Exception:
|
||||
logging.exception("Send password reset mail to {} failed".format(to))
|
||||
|
||||
Reference in New Issue
Block a user