mirror of
https://github.com/Cccc-owo/CheckInApp.git
synced 2026-06-17 05:56:29 +00:00
feat(auth): require verified email for approval
This commit is contained in:
@@ -159,6 +159,16 @@ class EmailService:
|
||||
|
||||
return EmailService.send_email(admin_emails, subject, body_html)
|
||||
|
||||
@staticmethod
|
||||
def send_email_verification_code(to_email: str, alias: str, code: str) -> bool:
|
||||
subject = f"【接龙自动打卡系统】邮箱验证码 - {alias}"
|
||||
body_html = (
|
||||
"<p>您正在验证接龙自动打卡系统账号邮箱。</p>"
|
||||
f"<p>验证码:<strong>{_email_text(code)}</strong></p>"
|
||||
"<p>验证码 10 分钟内有效。如非本人操作,请忽略本邮件。</p>"
|
||||
)
|
||||
return EmailService.send_email([to_email], subject, body_html)
|
||||
|
||||
@staticmethod
|
||||
def notify_user_approved(user: User) -> bool:
|
||||
"""
|
||||
@@ -174,6 +184,9 @@ class EmailService:
|
||||
if user_email is None:
|
||||
logger.info(f"用户 {user.alias} 未设置邮箱,跳过审批通知")
|
||||
return False
|
||||
if not user.email_verified_at:
|
||||
logger.info(f"用户 {user.alias} 邮箱未验证,跳过审批通知")
|
||||
return False
|
||||
|
||||
subject = f"【接龙自动打卡系统】账户审批通过 - {user.alias}"
|
||||
body_html = render_email_template(
|
||||
|
||||
Reference in New Issue
Block a user