fix(auth): 5 BUG 修复 — refresh token 持久化 + 密码验证 + 浏览器兼容
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

BUG-1 (P1): LoginPage 注册密码验证从 6 位改为 8 位,与后端一致
BUG-2 (P0): refresh token 持久化到 OS keyring + restoreSession 三级恢复
  (access token → refresh token → cookie auth) + saveSaaSSession 改为 await
BUG-3 (P0): Tauri 聊天路由降级问题,根因同 BUG-2(会话恢复失败)
BUG-4 (P1): App.tsx 跳过 Onboarding 改用 agentStore(兼容所有 client),
  Workspace.tsx Tauri invoke 改为动态 import 避免浏览器崩溃
BUG-5: tauri.conf.json createUpdaterArtifacts 改为 boolean true
This commit is contained in:
iven
2026-04-11 09:43:17 +08:00
parent 1171218276
commit d871685e25
6 changed files with 113 additions and 54 deletions

View File

@@ -170,8 +170,8 @@ export function LoginPage() {
setLocalError('邮箱格式不正确');
return;
}
if (password.length < 6) {
setLocalError('密码长度至少 6 个字符');
if (password.length < 8) {
setLocalError('密码长度至少 8 个字符');
return;
}
if (password !== confirmPassword) {
@@ -427,7 +427,7 @@ export function LoginPage() {
type={showPassword ? 'text' : 'password'}
value={password}
onChange={(e) => setPassword(e.target.value)}
placeholder={isRegister ? '密码(至少 6 位)' : '密码'}
placeholder={isRegister ? '密码(至少 8 位)' : '密码'}
autoComplete={isRegister ? 'new-password' : 'current-password'}
disabled={isLoading}
className={cn(inputClass, 'pr-10')}

View File

@@ -1,5 +1,4 @@
import { useEffect, useState } from 'react';
import { invoke } from '@tauri-apps/api/core';
import { useConfigStore } from '../../store/configStore';
import { silentErrorHandler } from '../../lib/error-utils';
@@ -11,13 +10,14 @@ export function Workspace() {
const [projectDir, setProjectDir] = useState('~/.zclaw/zclaw-workspace');
const [dirStats, setDirStats] = useState<{ fileCount: number; totalSize: number } | null>(null);
// Load real directory stats via Tauri command
// Load real directory stats via Tauri command (safe for browser mode)
const loadDirStats = async (dir: string) => {
try {
const { invoke } = await import('@tauri-apps/api/core');
const stats = await invoke<{ file_count: number; total_size: number }>('workspace_dir_stats', { path: dir });
setDirStats({ fileCount: stats.file_count, totalSize: stats.total_size });
} catch {
// Command may not exist in all modes — fallback to workspaceInfo
// Not in Tauri environment or command unavailable — fallback to workspaceInfo
}
};