diff --git a/apps/server/web/src/LoginPanel.tsx b/apps/server/web/src/LoginPanel.tsx new file mode 100644 index 0000000..b7b3da9 --- /dev/null +++ b/apps/server/web/src/LoginPanel.tsx @@ -0,0 +1,35 @@ +// Password-only subset of upstream components/LoginPanel.tsx; keep its layout/classes. +import { Alert, Button, Card, Form, Input, Typography } from 'antd' +import { GithubOutlined } from '@ant-design/icons' +import { useState } from 'react' +import { api, type Account } from './api' +import { ThemeToggle } from './ThemeToggle' +import { SiteFooter } from './SiteFooter' +export function LoginPanel({ onAuthSuccess, initialError }: { onAuthSuccess: (account: Account) => void; initialError?: string }) { + const [loading, setLoading] = useState(false) + const [error, setError] = useState(initialError ?? '') + const [form] = Form.useForm<{ email: string; password: string }>() + async function submit(values: { email: string; password: string }) { + setLoading(true); setError('') + try { + const result = await api('/auth/login', { email: values.email.trim(), password: values.password }) + form.resetFields(['password']); onAuthSuccess(result) + } catch (err) { setError(err instanceof Error ? err.message : '登录失败,请重试。') } + finally { setLoading(false) } + } + return <>
+
GitHub
+
+
DeepSeek Harness Remote
+ +
登录
+ {error && } +
+ + + +
+
+
+
+}