|
|
|
@ -29,63 +29,44 @@ def send_change_mail_task(language: str, to: str, code: str, phase: str):
|
|
|
|
"old_email": {
|
|
|
|
"old_email": {
|
|
|
|
"subject": "检测您现在的邮箱",
|
|
|
|
"subject": "检测您现在的邮箱",
|
|
|
|
"template_with_brand": "change_mail_confirm_old_template_zh-CN.html",
|
|
|
|
"template_with_brand": "change_mail_confirm_old_template_zh-CN.html",
|
|
|
|
"template_without_brand": "without-brand/change_mail_confirm_old_template_zh-CN.html"
|
|
|
|
"template_without_brand": "without-brand/change_mail_confirm_old_template_zh-CN.html",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"new_email": {
|
|
|
|
"new_email": {
|
|
|
|
"subject": "确认您的邮箱地址变更",
|
|
|
|
"subject": "确认您的邮箱地址变更",
|
|
|
|
"template_with_brand": "change_mail_confirm_new_template_zh-CN.html",
|
|
|
|
"template_with_brand": "change_mail_confirm_new_template_zh-CN.html",
|
|
|
|
"template_without_brand": "without-brand/change_mail_confirm_new_template_zh-CN.html"
|
|
|
|
"template_without_brand": "without-brand/change_mail_confirm_new_template_zh-CN.html",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"en": {
|
|
|
|
"en": {
|
|
|
|
"old_email": {
|
|
|
|
"old_email": {
|
|
|
|
"subject": "Check your current email",
|
|
|
|
"subject": "Check your current email",
|
|
|
|
"template_with_brand": "change_mail_confirm_old_template_en-US.html",
|
|
|
|
"template_with_brand": "change_mail_confirm_old_template_en-US.html",
|
|
|
|
"template_without_brand": "without-brand/change_mail_confirm_old_template_en-US.html"
|
|
|
|
"template_without_brand": "without-brand/change_mail_confirm_old_template_en-US.html",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"new_email": {
|
|
|
|
"new_email": {
|
|
|
|
"subject": "Confirm your new email address",
|
|
|
|
"subject": "Confirm your new email address",
|
|
|
|
"template_with_brand": "change_mail_confirm_new_template_en-US.html",
|
|
|
|
"template_with_brand": "change_mail_confirm_new_template_en-US.html",
|
|
|
|
"template_without_brand": "without-brand/change_mail_confirm_new_template_en-US.html"
|
|
|
|
"template_without_brand": "without-brand/change_mail_confirm_new_template_en-US.html",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# send change email mail using different languages
|
|
|
|
# send change email mail using different languages
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
system_features = FeatureService.get_system_features()
|
|
|
|
system_features = FeatureService.get_system_features()
|
|
|
|
if language == "zh-Hans":
|
|
|
|
lang_key = "zh-Hans" if language == "zh-Hans" else "en"
|
|
|
|
if phase == "old_email":
|
|
|
|
|
|
|
|
subject = "检测您现在的邮箱"
|
|
|
|
if phase not in ["old_email", "new_email"]:
|
|
|
|
if system_features.branding.enabled:
|
|
|
|
raise ValueError("Invalid phase")
|
|
|
|
template = "without-brand/change_mail_confirm_old_template_zh-CN.html"
|
|
|
|
|
|
|
|
else:
|
|
|
|
config = email_config[lang_key][phase]
|
|
|
|
template = "change_mail_confirm_old_template_zh-CN.html"
|
|
|
|
subject = config["subject"]
|
|
|
|
elif phase == "new_email":
|
|
|
|
|
|
|
|
subject = "确认您的邮箱地址变更"
|
|
|
|
if system_features.branding.enabled:
|
|
|
|
if system_features.branding.enabled:
|
|
|
|
template = config["template_without_brand"]
|
|
|
|
template = "without-brand/change_mail_confirm_new_template_zh-CN.html"
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
template = "change_mail_confirm_new_template_zh-CN.html"
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
raise ValueError("Invalid phase")
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if phase == "old_email":
|
|
|
|
template = config["template_with_brand"]
|
|
|
|
subject = "Check your current email"
|
|
|
|
|
|
|
|
if system_features.branding.enabled:
|
|
|
|
|
|
|
|
template = "without-brand/change_mail_confirm_old_template_en-US.html"
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
template = "change_mail_confirm_old_template_en-US.html"
|
|
|
|
|
|
|
|
elif phase == "new_email":
|
|
|
|
|
|
|
|
subject = "Confirm your new email address"
|
|
|
|
|
|
|
|
if system_features.branding.enabled:
|
|
|
|
|
|
|
|
template = "without-brand/change_mail_confirm_new_template_en-US.html"
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
template = "change_mail_confirm_new_template_en-US.html"
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
raise ValueError("Invalid phase")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
html_content = render_template(template, to=to, code=code)
|
|
|
|
html_content = render_template(template, to=to, code=code)
|
|
|
|
mail.send(to=to, subject=subject, html=html_content)
|
|
|
|
mail.send(to=to, subject=subject, html=html_content)
|
|
|
|
|
|
|
|
|
|
|
|
|