WIP-CHECKPOINT[auth-refactor]: 固化工程师崩溃前部分成果 + 同树其他未提交WIP(仅源码,不含密钥/二进制)-- 待重激活工程师续作
This commit is contained in:
@@ -198,22 +198,46 @@ async def scan_qrcode(
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>扫码成功</title>
|
||||
<title>扫码成功 - IT智能服务台</title>
|
||||
<style>
|
||||
body {{ font-family: -apple-system, BlinkMacSystemFont, sans-serif; background: #0f172a; color: #e2e8f0; display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; padding: 20px; }}
|
||||
.card {{ background: #1e293b; border-radius: 16px; padding: 40px 32px; max-width: 400px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }}
|
||||
h1 {{ color: #34d399; margin: 0 0 16px 0; font-size: 24px; }}
|
||||
p {{ color: #94a3b8; margin: 8px 0; line-height: 1.6; }}
|
||||
.ico {{ font-size: 56px; margin-bottom: 16px; }}
|
||||
* {{ margin: 0; padding: 0; box-sizing: border-box; }}
|
||||
body {{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }}
|
||||
.card {{ background: rgba(255,255,255,0.95); border-radius: 20px; padding: 48px 40px; max-width: 360px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }}
|
||||
.logo {{ width: 80px; height: 80px; margin-bottom: 24px; }}
|
||||
.title {{ color: #1f2937; font-size: 28px; font-weight: 600; margin-bottom: 8px; }}
|
||||
.subtitle {{ color: #6b7280; font-size: 14px; line-height: 1.6; margin-bottom: 24px; }}
|
||||
.status {{ display: inline-flex; align-items: center; gap: 8px; background: #dcfce7; color: #166534; padding: 12px 24px; border-radius: 50px; font-size: 14px; font-weight: 500; margin-bottom: 24px; }}
|
||||
.spinner {{ width: 20px; height: 20px; border: 2px solid #86efac; border-top-color: #166534; border-radius: 50%; animation: spin 1s linear infinite; }}
|
||||
@keyframes spin {{ to {{ transform: rotate(360deg); }} }}
|
||||
.tips {{ background: #f3f4f6; border-radius: 12px; padding: 16px; text-align: left; }}
|
||||
.tips-title {{ color: #374151; font-size: 13px; font-weight: 600; margin-bottom: 8px; }}
|
||||
.tips-item {{ color: #6b7280; font-size: 12px; line-height: 1.8; display: flex; align-items: flex-start; gap: 6px; }}
|
||||
.tips-item::before {{ content: '•'; color: #9ca3af; }}
|
||||
.footer {{ margin-top: 24px; color: #9ca3af; font-size: 12px; }}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<div class="ico">✅</div>
|
||||
<h1>扫码成功</h1>
|
||||
<p>请在刚才打开登录页的浏览器中</p>
|
||||
<p>点击 <strong style="color:#60a5fa">「确认登录」</strong> 按钮完成登录</p>
|
||||
<p style="margin-top:24px;font-size:13px;color:#64748b">本页可关闭</p>
|
||||
<svg class="logo" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="80" height="80" rx="16" fill="#07C160"/>
|
||||
<path d="M24 40c0-8.837 7.163-16 16-16s16 7.163 16 16-7.163 16-16 16-16-7.163-16-16zm16 0c0 4.418 3.582 8 8 8s8-3.582 8-8-3.582-8-8-8-8-3.582-8-8z" fill="white"/>
|
||||
<path d="M24 28c0-6.627 5.373-12 12-12s12 5.373 12 12V40c0 6.627-5.373 12-12 12s-12-5.373-12-12z" fill="white" opacity="0.7"/>
|
||||
<circle cx="40" cy="48" r="4" fill="white"/>
|
||||
<rect x="36" y="54" width="8" height="12" rx="2" fill="white"/>
|
||||
</svg>
|
||||
<h1 class="title">扫码成功</h1>
|
||||
<div class="status">
|
||||
<span class="spinner"></span>
|
||||
等待确认登录...
|
||||
</div>
|
||||
<p class="subtitle">请在电脑端的登录页面点击<br><strong style="color:#07C160">「确认登录」</strong> 按钮完成登录</p>
|
||||
<div class="tips">
|
||||
<div class="tips-title">📋 操作指引</div>
|
||||
<div class="tips-item">已在电脑上打开登录页面</div>
|
||||
<div class="tips-item">点击页面上的「确认登录」按钮</div>
|
||||
<div class="tips-item">登录成功后可关闭此页面</div>
|
||||
</div>
|
||||
<div class="footer">IT智能服务台 · 税友集团</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>"""
|
||||
@@ -271,6 +295,21 @@ async def confirm_qrcode(
|
||||
otp_code=body.otp_code,
|
||||
)
|
||||
|
||||
# 同步头像:扫码时已从企微API拿到最新头像URL,这里落库 + 清缓存
|
||||
# (要求 A:确保所有登录路径刷新头像;头像更新失败不阻塞登录)
|
||||
confirm_avatar = result.get("avatar", "")
|
||||
if confirm_avatar:
|
||||
try:
|
||||
from app.services.avatar_service import sync_employee_avatar
|
||||
await sync_employee_avatar(
|
||||
db, redis_client, result["employee_id"], confirm_avatar
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning(
|
||||
f"扫码确认同步头像失败(不阻塞): "
|
||||
f"employee_id={result.get('employee_id')}, error={e}"
|
||||
)
|
||||
|
||||
# 记录扫码登录日志(成功)
|
||||
from app.services.audit_log_service import record_audit_log
|
||||
await record_audit_log(
|
||||
|
||||
Reference in New Issue
Block a user