Insert reset password dialog before closing Layout
cgen-c7f95b0a8bd24473ad88b9adf3401b9c
This commit is contained in:
parent
3ee63a98c9
commit
79a1263fec
1 changed files with 42 additions and 0 deletions
|
|
@ -390,6 +390,48 @@ export default function Login() {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Dialog open={showReset} onOpenChange={setShowReset}>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Reset your password</DialogTitle>
|
||||
<DialogDescription>
|
||||
Enter the email associated with your account. We'll send a reset link.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="space-y-3 py-2">
|
||||
<Label htmlFor="resetEmail" className="text-sm font-medium">
|
||||
Email Address
|
||||
</Label>
|
||||
<Input
|
||||
id="resetEmail"
|
||||
type="email"
|
||||
value={resetEmail}
|
||||
onChange={(e) => setResetEmail(e.target.value)}
|
||||
placeholder="you@example.com"
|
||||
/>
|
||||
</div>
|
||||
<DialogFooter className="sm:justify-end">
|
||||
<DialogClose asChild>
|
||||
<Button variant="outline">Cancel</Button>
|
||||
</DialogClose>
|
||||
<Button
|
||||
onClick={async () => {
|
||||
if (!resetEmail) return;
|
||||
setIsLoading(true);
|
||||
try {
|
||||
await requestPasswordReset(resetEmail);
|
||||
setShowReset(false);
|
||||
} catch {}
|
||||
setIsLoading(false);
|
||||
}}
|
||||
disabled={!resetEmail || isLoading}
|
||||
>
|
||||
Send reset link
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue