forgot password with Email OTP

Hi everyone! I'm working on a forgot password feature using Next.js, Prisma, and PostgreSQL. When I submit the email on the forgot password page, and the email doesn't exist in the database, it doesn't show an error like "User email doesn't exist." It just silently fails. Here's the code snippet I'm using:
const { data, error } = await emailOtp.sendVerificationOtp({
email: values.email,
type: 'forget-password',
fetchOptions: {
onSuccess: (ctx) => {
console.log(ctx.data, 'Success');
},
onError: (ctx) => {
console.log(ctx.error.message, 'Error');
},
}
});
const { data, error } = await emailOtp.sendVerificationOtp({
email: values.email,
type: 'forget-password',
fetchOptions: {
onSuccess: (ctx) => {
console.log(ctx.data, 'Success');
},
onError: (ctx) => {
console.log(ctx.error.message, 'Error');
},
}
});
Does anyone know how I can handle this and show an appropriate error message when the email is not found? Any help would be appreciated!
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?