refactor: 更新认证方式为密码验证

简化认证流程,移除用户名,只需要输入访问密码:

## 后端更改
- 移除 JWT_SECRET、ADMIN_USERNAME、ADMIN_PASSWORD 配置
- 添加 ACCESS_PASSWORD 配置
- 更新认证接口:POST /api/auth/verify-password
- 简化 JWT payload,只包含认证状态和时间戳
- 移除用户管理相关代码
- 更新认证中间件

## 前端更改
- 登录页面只显示密码输入框
- 移除用户名输入和相关状态
- 更新 Pinia store 为 verifyPassword 方法
- 移除 User 类型定义
- 更新布局和设置页面

## 文档更改
- 更新 README.md 说明新的认证方式
- 更新 DEVELOPMENT_GUIDE.md 环境变量配置
- 更新 API.md 认证接口文档
- 更新 .env.example 配置模板

## 安全改进
- 使用 ACCESS_PASSWORD 作为 JWT 签名密钥
- 自动清理过期会话(7天)
- 简化配置,更易于部署

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
hughhuangandClaude Sonnet 4.5 committed 2026-01-02 23:04:49 +08:00
1 parent ed626e74dc
commit 903dc1e61f
15 files changed
+124 -171

No files matched your search

+3 -10
View File
@@ -1,11 +1,5 @@
// 通用类型定义
export interface User {
id: string;
username: string;
createdAt: Date;
}
export interface InstanceConfig {
model: string;
apiKey?: string;
@@ -34,14 +28,13 @@ export interface Instance {
lastStarted?: Date;
}
export interface LoginRequest {
username: string;
export interface VerifyPasswordRequest {
password: string;
}
export interface LoginResponse {
export interface VerifyPasswordResponse {
success: boolean;
token: string;
user: User;
}
export interface ApiResponse<T = any> {