feat: custom password reset flow (token-based, Appwrite Messaging)
- db: new password_resets table (email, userId, tokenHash, expiresAt, usedAt) - lib: password-reset-actions.ts — requestPasswordResetAction, verifyResetToken, resetPasswordAction - lib: Messaging added to createAdminClient - page: /reset-password — validates token server-side, shows form or error card - page: /forgot-password — now uses requestPasswordResetAction (custom flow) - page: /sign-in — shows success banner after ?reset=success redirect
This commit is contained in:
@@ -9,11 +9,11 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/com
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { forgotPasswordAction } from "@/lib/appwrite/auth-actions";
|
||||
import { requestPasswordResetAction } from "@/lib/appwrite/password-reset-actions";
|
||||
import { initialAuthState } from "@/lib/appwrite/auth-types";
|
||||
|
||||
export function ForgotPasswordForm1({ className, ...props }: React.ComponentProps<"div">) {
|
||||
const [state, formAction, isPending] = useActionState(forgotPasswordAction, initialAuthState);
|
||||
const [state, formAction, isPending] = useActionState(requestPasswordResetAction, initialAuthState);
|
||||
|
||||
return (
|
||||
<div className={cn("flex flex-col gap-6", className)} {...props}>
|
||||
|
||||
Reference in New Issue
Block a user