'use client' import { useState } from 'react' import { useRouter } from 'next/navigation' import BrandingLogo from '../ui/BrandingLogo' import { getApiBase } from '../lib/auth' export default function ForgotPasswordPage() { const router = useRouter() const [identifier, setIdentifier] = useState('') const [loading, setLoading] = useState(false) const [error, setError] = useState(null) const [status, setStatus] = useState(null) const submit = async (event: React.FormEvent) => { event.preventDefault() if (!identifier.trim()) { setError('Enter your username or email.') return } setLoading(true) setError(null) setStatus(null) try { const baseUrl = getApiBase() const response = await fetch(`${baseUrl}/auth/password/forgot`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ identifier: identifier.trim() }), }) const data = await response.json().catch(() => null) if (!response.ok) { throw new Error(typeof data?.detail === 'string' ? data.detail : 'Unable to send reset link.') } setStatus( typeof data?.message === 'string' ? data.message : 'If an account exists for that username or email, a password reset link has been sent.', ) } catch (err) { console.error(err) setError(err instanceof Error ? err.message : 'Unable to send reset link.') } finally { setLoading(false) } } return (

Forgot password

Enter the username or email you use for Jellyfin or Magent. If the account is eligible, a reset link will be emailed to you.

{error &&
{error}
} {status &&
{status}
}
) }