This repository has been archived on 2026-06-21. You can view files and clone it, but cannot push or open issues or pull requests.
Files
MetaLab/templates/MetaLab-2026/static/css/common.css
Victor_Jay 0800ee2f3e feat: 消息通知中心 + 账号安全体系 + Bug修复
## 新增功能

### 消息通知中心 (全新模块)
- 新增 MessageController / NotificationService / NotificationRepo
- SSR 消息页面 (/messages):左侧边栏 + 右侧卡片列表,noindex 元标签
- 通知能力:列表分页、单条标为已读、一键全部标为已读
- 未读数角标 (1/66/99+):侧边栏 + 导航栏铃铛图标
- 导航栏轮询 /api/messages/unread 每 60 秒刷新未读数
- 审核通过/驳回时自动 fire-and-forget 推送通知

### 密码修改
- ChangePassword:验证当前密码 → 新密码强度校验(8位+字母+数字) → 哈希更新
- 修改后递增 token_version 强制所有设备退登

### 账号自助注销
- DeleteAccount:验证密码 → 设置 deleted 状态 → 记录原因 → 吊销 JWT
- 注销后登录二次确认:Login 检测 deleted → 返回 confirm_restore
- ConfirmRestore 恢复账号,重新签发 token
- 注销页文案:"账号将在 7 天后正式注销,期间可随时重新登录恢复"

### IP 审计记录
- 注册时记录 RegIP,登录时记录 LastLoginIP + LastLoginAt
- clientIP() 支持 X-Forwarded-For / X-Real-IP 反向代理

### 安全加固
- Login 防时序攻击:用户不存在时仍执行完整 bcrypt 比对
- FindByEmail 改用 Unscoped() 覆盖软删除用户
- 站长 (owner) 不允许自主注销,避免权限体系死锁

## Bug 修复

1. 注销按钮不触发:JS IIFE 中 profile 代码 return 阻塞了 account 标签页处理器注册
   → 拆分为两层 IIFE,profile 放在内层
2. label 缺少 for 属性导致控制台警告 → 全部补充 for 属性
3. 注销后未自动退登:DeleteAccount 只设状态未吊销 JWT → 末尾加 InvalidateSessions
4. 退登后重定向 500 panic:authenticateToken 中 err||versionMismatch 合并判断
   在 err=nil 但版本不匹配时返回 (nil,nil) → 拆为两个独立判断
   injectUserContext 增加 claims==nil / 类型断言空安全守卫
5. 注销后登录直接提示"登录成功":FindByEmail 默认 scope 排除软删除记录
   → 改用 Unscoped()

## 文件变更
- 新建 17 个文件 (消息/审核/站点设置完整模块)
- 修改 25 个文件 (认证/设置/中间件/前端)
- 统计:+3229 / -161,42 files changed
2026-05-27 13:32:45 +08:00

278 lines
5.3 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* ============================================================
MetaLab Common Styles — 全站共享样式Reset / 变量 / 导航 / 页脚)
每个页面加载此文件后,按需加载页面专属 CSS
============================================================ */
:root {
--color-bg: #f8f9fa;
--color-surface: #fff;
--color-primary: #2c3e50;
--color-secondary: #7f8c8d;
--color-accent: #3498db;
--color-danger: #e74c3c;
--color-border: #e0e0e0;
--color-text: #333;
--color-text-light: #666;
--shadow: 0 4px 12px rgba(0,0,0,.08);
--radius: 8px;
--transition: all .3s ease;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
/* ---------- Reset ---------- */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {}
body {
background: var(--color-bg);
color: var(--color-text);
line-height: 1.6;
overflow-x: hidden;
}
a {
text-decoration: none;
color: inherit;
}
/* ---------- Layout ---------- */
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
.icon {
width: 1em;
height: 1em;
vertical-align: -.125em;
display: inline-block;
flex-shrink: 0;
}
/* ---------- Header / Nav ---------- */
header {
background: var(--color-surface);
box-shadow: var(--shadow);
position: sticky;
top: 0;
z-index: 1000;
}
.nav-container {
display: flex;
justify-content: space-between;
align-items: center;
padding: .6rem 0;
}
.logo {
font-size: 1.4rem;
font-weight: 700;
color: var(--color-primary);
}
.logo span {
color: var(--color-accent);
}
.nav-links {
display: flex;
list-style: none;
gap: 2rem;
}
.nav-links a {
font-weight: 500;
padding: .5rem 0;
position: relative;
transition: var(--transition);
}
.nav-links a:hover,
.nav-links a.nav-active {
color: var(--color-accent);
}
.nav-links a::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 2px;
background: var(--color-accent);
transition: width .3s ease;
}
.nav-links a:hover::after,
.nav-links a.nav-active::after {
width: 100%;
}
.nav-login {
color: var(--color-accent) !important;
font-weight: 600 !important;
}
.nav-user {
color: var(--color-accent) !important;
font-weight: 600 !important;
}
.nav-logout {
color: var(--color-secondary) !important;
}
/* ---------- Nav Messages Bell ---------- */
.nav-messages {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 6px;
border-radius: 50%;
transition: background .15s ease;
}
.nav-messages:hover {
background: rgba(52, 152, 219, .08);
}
.nav-bell-icon {
width: 20px;
height: 20px;
display: block;
}
.nav-bell-badge {
position: absolute;
top: 0;
right: -2px;
min-width: 16px;
height: 16px;
padding: 0 4px;
font-size: .65rem;
font-weight: 700;
color: #fff;
background: var(--color-danger);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
line-height: 1;
}
.mobile-menu-btn {
display: none;
background: none;
border: none;
font-size: 1.5rem;
color: var(--color-primary);
cursor: pointer;
}
/* ---------- Contact / Footer ---------- */
.contact-bar {
text-align: center;
padding: .6rem 0;
background: #e8f0f8;
border-top: 1px solid var(--color-border);
font-size: .95rem;
color: var(--color-text-light);
}
.contact-bar a {
color: var(--color-accent);
font-weight: 600;
transition: var(--transition);
}
.contact-bar a:hover {
color: #2980b9;
text-decoration: underline;
}
footer {
background: var(--color-primary);
color: #bdc3c7;
padding: .8rem 0;
}
.footer-content {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
}
.copyright {
font-size: .9rem;
color: #95a5a6;
width: 100%;
}
/* ---------- Scroll-to-top ---------- */
.scroll-top-btn {
position: fixed;
bottom: 1.5rem;
right: 1.5rem;
width: 44px;
height: 44px;
border-radius: 50%;
background: var(--color-accent);
color: #fff;
border: none;
box-shadow: 0 4px 12px rgba(52,152,219,.35);
cursor: pointer;
font-size: 1.1rem;
display: flex;
align-items: center;
justify-content: center;
z-index: 999;
opacity: 0;
visibility: hidden;
transform: translateY(10px);
transition: opacity .3s ease, visibility .3s ease, transform .3s ease;
}
.scroll-top-btn.visible {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.scroll-top-btn:hover {
background: #2980b9;
transform: translateY(-2px);
box-shadow: 0 6px 16px rgba(52,152,219,.45);
}
/* ---------- Responsive (共享:导航) ---------- */
@media (max-width: 768px) {
.nav-links {
display: none;
position: absolute;
top: 100%;
left: 0;
width: 100%;
background: var(--color-surface);
flex-direction: column;
padding: 1.5rem;
box-shadow: 0 10px 15px rgba(0,0,0,.1);
text-align: center;
}
.nav-links.active {
display: flex;
}
.mobile-menu-btn {
display: block;
}
}