feat: 添加 OAuth 认证支持及相关改进

- 新增 OAuth 模块,支持 LinuxDo/GitHub/Google 等第三方登录
- 用户邮箱改为可选字段,支持无邮箱注册
- 新增模块配置验证状态 (config_validated/config_error)
- 系统设置界面改为分块独立保存
- 用户设置新增 OAuth 绑定管理和首次密码设置
- 登录界面支持 OAuth 按钮展示
- 邮箱验证设置移至邮件设置页面
This commit is contained in:
fawney19
2026-01-19 03:19:17 +08:00
parent e2e14fd09c
commit 3d88dfd98a
61 changed files with 4548 additions and 950 deletions

View File

@@ -98,6 +98,21 @@ class EmailSenderService:
return True, None
@staticmethod
def is_smtp_configured(db: Session) -> bool:
"""
检查 SMTP 是否已配置(用于前端显示判断)
Args:
db: 数据库会话
Returns:
是否已配置有效的 SMTP
"""
config = EmailSenderService._get_smtp_config(db)
valid, _ = EmailSenderService._validate_smtp_config(config)
return valid
@staticmethod
async def send_verification_code(
db: Session, to_email: str, code: str, expire_minutes: int = 30