import "./AuthTokenRecoveryDialog.css"; import { useCallback, useEffect, useRef, useState } from "react"; import { clearAuthToken, setAuthToken } from "../auth"; export interface AuthTokenRecoveryDialogProps { open: boolean; } export function AuthTokenRecoveryDialog({ open }: AuthTokenRecoveryDialogProps) { const [tokenInput, setTokenInput] = useState(""); const tokenInputRef = useRef(null); useEffect(() => { if (!open) return; tokenInputRef.current?.focus(); }, [open]); const handleSetToken = useCallback(() => { const token = tokenInput.trim(); if (!token) return; setAuthToken(token); window.location.reload(); }, [tokenInput]); const handleClearAndRetry = useCallback(() => { clearAuthToken(); window.location.reload(); }, []); if (!open) { return null; } return (
{ if (event.key === "Escape") { event.preventDefault(); event.stopPropagation(); } }} >

Authentication token required

This dashboard session can't authenticate with the daemon. Set a replacement token or clear the current token and retry.

setTokenInput(event.target.value)} placeholder="Paste token" autoComplete="off" spellCheck={false} />
); }