feat: 登录改为 Casdoor 统一身份认证(SSO),重建用户体系

- 移除内置密码注册/登录/改密/删号/头像,统一走 Casdoor OIDC 授权码
- 服务端 casdoor-nodejs-sdk:code 换 token + 证书公钥验签 + get-account 补齐资料
- 用户表重建为 provider+provider_id(Casdoor sub 为准),邮箱不再唯一
- 管理员由 Casdoor token 的 isAdmin/IsAdmin 字段或 admin 角色判定,删除角色切换接口
- 前端登录弹窗改为申统认证跳转,注册去 Casdoor;后台用户列表只读角色
- 会话沿用 an_session httpOnly Cookie,requireUser/requireAdmin 守卫保留
- 配置注入 deploy.sh/.env.example;新增 casdoor 单测,删除 password 单测
This commit is contained in:
2026-08-09 00:18:47 +08:00
parent bdafac2857
commit 337eb4f05a
51 changed files with 1395 additions and 1504 deletions
+51 -4
View File
@@ -26,6 +26,43 @@ export interface ToolItem {
descEn: string
}
/** 首页 Hero 背景画廊 */
export interface HeroSettings {
/** 图片 URL 列表,均分到左右两列;为空时显示品牌纯色兜底 */
gallery: string[]
}
/** 首页「成就数据」:数字统计(可在后台配置) */
export interface AchievementItem {
id: string
number: number
suffix: string
titleZh: string
titleEn: string
descriptionZh: string
descriptionEn: string
}
/** 首页「客户评价」(可在后台配置) */
export interface TestimonialItem {
id: string
name: string
roleZh: string
roleEn: string
contentZh: string
contentEn: string
}
/** 首页「合作伙伴」(可在后台配置;无 logo 时显示名称文字) */
export interface PartnerItem {
id: string
name: string
/** logo 图片 URL,可留空 */
logo?: string | null
/** 合作伙伴官网链接,可留空 */
url?: string | null
}
export interface SiteSettings {
site: {
name: string
@@ -40,6 +77,10 @@ export interface SiteSettings {
}
socials: SocialLink[]
tools: ToolItem[]
hero: HeroSettings
achievements: AchievementItem[]
testimonials: TestimonialItem[]
partners: PartnerItem[]
footer: {
title: LocalizedText
newsletterTitle: LocalizedText
@@ -71,10 +112,10 @@ export const defaultSettings: SiteSettings = {
},
},
socials: [
{ name: 'X', icon: 'ph:x-logo', url: 'https://x.com/arcticnewone' },
{ name: 'Instagram', icon: 'ph:instagram-logo', url: 'https://instagram.com/arcticnewone' },
{ name: 'LinkedIn', icon: 'ph:linkedin-logo', url: 'https://www.linkedin.com/company/arcticnewone' },
{ name: 'GitHub', icon: 'ph:github-logo', url: 'https://github.com/arcticnewone' },
{ name: '微博', icon: 'ri:weibo-fill', url: '' },
{ name: '知乎', icon: 'ri:zhihu-fill', url: '' },
{ name: '哔哩哔哩', icon: 'ri:bilibili-fill', url: '' },
{ name: 'GitHub', icon: 'ri:github-fill', url: '' },
],
tools: [
{
@@ -105,6 +146,12 @@ export const defaultSettings: SiteSettings = {
descEn: 'An all-in-one practical tool collection for developers and IT professionals.',
},
],
hero: {
gallery: [],
},
achievements: [],
testimonials: [],
partners: [],
footer: {
title: {
zh: '雕琢视觉,塑造故事。\n让我们共创卓越作品!',