fix(auth): retain input on failure + copy fixes

This commit is contained in:
Gabriel Brown
2026-07-11 17:23:25 -04:00
parent a3ec04ad99
commit d873c8eaf7
3 changed files with 68 additions and 11 deletions
+11 -7
View File
@@ -132,12 +132,14 @@ const SignIn = () => {
formData.append('flow', flow);
setLoading(true);
try {
await signIn('password', formData).then(() => router.push('/dashboard'));
await signIn('password', formData).then(() => {
signInForm.reset();
router.push('/dashboard');
});
} catch (error) {
console.error('Error signing in:', error);
toast.error('Error signing in.');
} finally {
signInForm.reset();
setLoading(false);
}
};
@@ -153,6 +155,7 @@ const SignIn = () => {
if (values.confirmPassword !== values.password)
throw new ConvexError('Passwords do not match.');
await signIn('password', formData).then(() => {
signUpForm.reset();
setEmail(values.email);
setFlow('email-verification');
});
@@ -160,7 +163,6 @@ const SignIn = () => {
console.error('Error signing up:', error);
toast.error('Error signing up.');
} finally {
signUpForm.reset();
setLoading(false);
}
};
@@ -174,12 +176,14 @@ const SignIn = () => {
formData.append('email', email);
setLoading(true);
try {
await signIn('password', formData).then(() => router.push('/dashboard'));
await signIn('password', formData).then(() => {
verifyEmailForm.reset();
router.push('/dashboard');
});
} catch (error) {
console.error('Error verifying email:', error);
toast.error('Error verifying email.');
} finally {
verifyEmailForm.reset();
setLoading(false);
}
};
@@ -232,7 +236,7 @@ const SignIn = () => {
/>
<SubmitButton
disabled={loading}
pendingText='Signing Up...'
pendingText='Verifying...'
className='mx-auto w-2/3 text-xl font-semibold'
>
Verify Email
@@ -423,7 +427,7 @@ const SignIn = () => {
render={({ field }) => (
<FormItem>
<FormLabel className='text-xl'>
Confirm Passsword
Confirm Password
</FormLabel>
<FormControl>
<Input