Prettier format pending files

This commit is contained in:
Builder.io 2025-10-18 01:19:59 +00:00
parent ed2aee92b9
commit f3efb14d7a
3 changed files with 57 additions and 15 deletions

View file

@ -844,7 +844,9 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
description: `We sent a password reset link to ${email}.`, description: `We sent a password reset link to ${email}.`,
}); });
} catch (error: any) { } catch (error: any) {
const msg = String(error?.message || error || "Failed to send reset email"); const msg = String(
error?.message || error || "Failed to send reset email",
);
aethexToast.error({ title: "Reset failed", description: msg }); aethexToast.error({ title: "Reset failed", description: msg });
throw new Error(msg); throw new Error(msg);
} }
@ -869,7 +871,9 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
}); });
} }
} catch (error: any) { } catch (error: any) {
const msg = String(error?.message || error || "Failed to update password"); const msg = String(
error?.message || error || "Failed to update password",
);
aethexToast.error({ title: "Update failed", description: msg }); aethexToast.error({ title: "Update failed", description: msg });
throw new Error(msg); throw new Error(msg);
} }

View file

@ -51,8 +51,15 @@ export default function Login() {
const [showReset, setShowReset] = useState(false); const [showReset, setShowReset] = useState(false);
const [resetEmail, setResetEmail] = useState(""); const [resetEmail, setResetEmail] = useState("");
const navigate = useNavigate(); const navigate = useNavigate();
const { signIn, signUp, signInWithOAuth, user, loading, profileComplete, requestPasswordReset } = const {
useAuth(); signIn,
signUp,
signInWithOAuth,
user,
loading,
profileComplete,
requestPasswordReset,
} = useAuth();
const { info: toastInfo, error: toastError } = useAethexToast(); const { info: toastInfo, error: toastError } = useAethexToast();
// After auth resolves and a user exists, navigate to dashboard // After auth resolves and a user exists, navigate to dashboard
@ -396,7 +403,8 @@ export default function Login() {
<DialogHeader> <DialogHeader>
<DialogTitle>Reset your password</DialogTitle> <DialogTitle>Reset your password</DialogTitle>
<DialogDescription> <DialogDescription>
Enter the email associated with your account. We'll send a reset link. Enter the email associated with your account. We'll send a reset
link.
</DialogDescription> </DialogDescription>
</DialogHeader> </DialogHeader>
<div className="space-y-3 py-2"> <div className="space-y-3 py-2">

View file

@ -1,6 +1,12 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import Layout from "@/components/Layout"; import Layout from "@/components/Layout";
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"; import {
Card,
CardContent,
CardHeader,
CardTitle,
CardDescription,
} from "@/components/ui/card";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label"; import { Label } from "@/components/ui/label";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
@ -40,21 +46,33 @@ export default function ResetPassword() {
const handleSubmit = async (e: React.FormEvent) => { const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault(); e.preventDefault();
if (!password || password.length < 6) { if (!password || password.length < 6) {
toastError({ title: "Invalid password", description: "Minimum 6 characters." }); toastError({
title: "Invalid password",
description: "Minimum 6 characters.",
});
return; return;
} }
if (password !== confirm) { if (password !== confirm) {
toastError({ title: "Passwords do not match", description: "Please re-enter matching passwords." }); toastError({
title: "Passwords do not match",
description: "Please re-enter matching passwords.",
});
return; return;
} }
setSubmitting(true); setSubmitting(true);
try { try {
await updatePassword(password); await updatePassword(password);
toastSuccess({ title: "Password updated", description: "Please sign in with your new password." }); toastSuccess({
title: "Password updated",
description: "Please sign in with your new password.",
});
navigate("/login", { replace: true }); navigate("/login", { replace: true });
} catch (err: any) { } catch (err: any) {
// Error already toasted in context; keep here for safety // Error already toasted in context; keep here for safety
toastError({ title: "Update failed", description: err?.message || "Try again." }); toastError({
title: "Update failed",
description: err?.message || "Try again.",
});
} finally { } finally {
setSubmitting(false); setSubmitting(false);
} }
@ -62,7 +80,11 @@ export default function ResetPassword() {
if (isLoading) { if (isLoading) {
return ( return (
<LoadingScreen message="Preparing password reset..." showProgress={true} duration={1500} /> <LoadingScreen
message="Preparing password reset..."
showProgress={true}
duration={1500}
/>
); );
} }
@ -72,13 +94,19 @@ export default function ResetPassword() {
<div className="container mx-auto px-4 max-w-md"> <div className="container mx-auto px-4 max-w-md">
<Card className="bg-card/50 backdrop-blur-sm border border-border/50 shadow-2xl"> <Card className="bg-card/50 backdrop-blur-sm border border-border/50 shadow-2xl">
<CardHeader className="text-center space-y-2"> <CardHeader className="text-center space-y-2">
<CardTitle className="text-2xl text-gradient-purple">Set a new password</CardTitle> <CardTitle className="text-2xl text-gradient-purple">
<CardDescription>Enter and confirm your new password</CardDescription> Set a new password
</CardTitle>
<CardDescription>
Enter and confirm your new password
</CardDescription>
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<form onSubmit={handleSubmit} className="space-y-4"> <form onSubmit={handleSubmit} className="space-y-4">
<div className="space-y-2"> <div className="space-y-2">
<Label htmlFor="password" className="text-sm font-medium">New Password</Label> <Label htmlFor="password" className="text-sm font-medium">
New Password
</Label>
<Input <Input
id="password" id="password"
type="password" type="password"
@ -90,7 +118,9 @@ export default function ResetPassword() {
/> />
</div> </div>
<div className="space-y-2"> <div className="space-y-2">
<Label htmlFor="confirm" className="text-sm font-medium">Confirm Password</Label> <Label htmlFor="confirm" className="text-sm font-medium">
Confirm Password
</Label>
<Input <Input
id="confirm" id="confirm"
type="password" type="password"