feat: 支持 OAuth 无密码用户设置密码和查看 API Key

- 新增 POST /auth/set-password 端点(仅限无密码用户)
- /auth/me 返回 hasPassword 字段
- SettingsDialog:无密码用户显示"设置密码"表单(无需当前密码)
- API Key reveal/copy:无密码时引导用户先设置密码
- 中英双语 i18n 支持

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 13:39:46 +08:00
parent a9a7216447
commit 9733b82c9c
5 changed files with 178 additions and 58 deletions

View File

@@ -1,7 +1,7 @@
import { createContext, useContext, useState, useEffect, type ReactNode } from 'react';
import { getAccessToken, clearTokens, setTokens, apiFetch } from './api';
type User = { id: string; email: string; name: string };
type User = { id: string; email: string; name: string; hasPassword?: boolean };
type AuthContextType = {
user: User | null;