import { LoaderCircle, MailIcon, SendHorizonalIcon } from 'lucide-react' import { Input } from '../ui/input' import { Label } from '../ui/label' import { useCallback, useState } from 'react' import { toast } from '../ui/use-toast' import { buttonVariants } from '../ui/button' import { cn } from '@/lib/utils' import { pb } from '@/lib/stores' import { Dialog, DialogHeader } from '../ui/dialog' import { DialogContent, DialogTrigger, DialogTitle } from '../ui/dialog' const showLoginFaliedToast = () => { toast({ title: 'Login attempt failed', description: 'Please check your credentials and try again', variant: 'destructive', }) } export default function ForgotPassword() { const [isLoading, setIsLoading] = useState(false) const [email, setEmail] = useState('') const handleSubmit = useCallback( async (e: React.FormEvent) => { e.preventDefault() setIsLoading(true) try { // console.log(email) await pb.collection('users').requestPasswordReset(email) toast({ title: 'Password reset request received', description: `Check ${email} for a reset link.`, }) } catch (e) { showLoginFaliedToast() } finally { setIsLoading(false) setEmail('') } }, [email] ) return ( <>
setEmail(e.target.value)} id="email" name="email" required placeholder="name@example.com" type="email" autoCapitalize="none" autoComplete="email" autoCorrect="off" disabled={isLoading} className="pl-9" />
Command line instructions

Use the following command to reset your password:

beszel admin update youremail@example.com newpassword
) }