feat(auth): 支持企业微信重置密码

This commit is contained in:
sophie committed 2026-06-15 13:36:35 +08:00
1 parent 9bc4d1dd18
commit f7890be317
53 files changed
+2702 -535

No files matched your search

+16 -2
View File
@@ -27,8 +27,22 @@ def _get_enabled_events() -> set[str]:
return set()
def _get_notify_base_url() -> str:
"""
解析企微 textcard 跳转基地址。
核心逻辑:优先 WECOM_NOTIFY_BASE_URL,其次 WECOM_PUBLIC_BASE_URL。
Returns:
去掉尾斜杠的基地址;均未配置时返回空字符串。
"""
for key in ('WECOM_NOTIFY_BASE_URL', 'WECOM_PUBLIC_BASE_URL'):
raw = current_app.config.get(key)
if isinstance(raw, str) and raw.strip():
return raw.strip().rstrip('/')
return ''
def _build_jump_url(path: str, trace_id: str, params: dict | None = None) -> str:
base = current_app.config.get('WECOM_NOTIFY_BASE_URL') or ''
base = _get_notify_base_url()
if not base:
return ''
base = base.rstrip('/')
@@ -133,7 +147,7 @@ def send_wecom_textcard_message(
'textcard': {
'title': title[:120],
'description': (description or '')[:1024],
'url': jump_url or (current_app.config.get('WECOM_NOTIFY_BASE_URL') or 'https://work.weixin.qq.com'),
'url': jump_url or _get_notify_base_url() or 'https://work.weixin.qq.com',
'btntxt': '查看详情',
},
'safe': 0,