import { createFileRoute, Link } from '@tanstack/react-router' import { useState } from 'react' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { authApi } from '@/lib/api' import { RugLogo } from '@/components/brand/RugLogo' export const Route = createFileRoute('/forgot-password')({ component: ForgotPasswordPage, }) function ForgotPasswordPage() { const [email, setEmail] = useState('') const [submitting, setSubmitting] = useState(false) const [sent, setSent] = useState(false) const [error, setError] = useState(null) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() if (!email) return setSubmitting(true) setError(null) try { await authApi.forgotPassword(email) setSent(true) } catch { setError('Something went wrong. Please try again.') } finally { setSubmitting(false) } } return (
{/* Logo / branding */}

Reset Password

Enter your email to receive a reset link. After resetting, you will set up zero-knowledge authentication.

{sent ? (

If an account with that email exists, a password reset link has been sent. Check your inbox.

Back to Sign In
) : (
void handleSubmit(e)} className="space-y-4">
{ setEmail(e.target.value) if (error) setError(null) }} placeholder="admin@example.com" autoComplete="email" autoFocus required />
{error && (

{error}

)} Back to Sign In
)}
) }