feat(frontend): require center API key on login/auth calls
This commit is contained in:
@@ -7,6 +7,7 @@ export default function LoginPage() {
|
||||
const navigate = useNavigate()
|
||||
const { login, isAuthed, session } = useAuth()
|
||||
const [centerApiBase, setCenterApiBase] = useState('http://localhost:7001/api')
|
||||
const [centerApiKey, setCenterApiKey] = useState('')
|
||||
const [email, setEmail] = useState('')
|
||||
const [password, setPassword] = useState('')
|
||||
const [error, setError] = useState('')
|
||||
@@ -15,7 +16,7 @@ export default function LoginPage() {
|
||||
e.preventDefault()
|
||||
setError('')
|
||||
try {
|
||||
await login(centerApiBase.trim(), email, password)
|
||||
await login(centerApiBase.trim(), centerApiKey.trim(), email, password)
|
||||
navigate('/workspace')
|
||||
} catch {
|
||||
setError('登录失败,请检查账号密码')
|
||||
@@ -32,6 +33,11 @@ export default function LoginPage() {
|
||||
onChange={(e) => setCenterApiBase(e.target.value)}
|
||||
placeholder="Center API Base (e.g. http://localhost:7001/api)"
|
||||
/>
|
||||
<input
|
||||
value={centerApiKey}
|
||||
onChange={(e) => setCenterApiKey(e.target.value)}
|
||||
placeholder="Center API Key"
|
||||
/>
|
||||
<input value={email} onChange={(e) => setEmail(e.target.value)} placeholder="Email" type="email" />
|
||||
<input
|
||||
value={password}
|
||||
|
||||
Reference in New Issue
Block a user