fix: redirect to 404 page for invalid email verification token (#9499)
* fix:redirect to 404 page for invalid email token * update 404 page to include invalid token error * fix: use i18n Signed-off-by: Udit Takkar <[email protected]> --------- Signed-off-by: Udit Takkar <[email protected]> Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
1 parent
212f7a374f
commit
f469a9c127
3 files changed
+15
-3
No files matched your search
@@ -19,11 +19,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
});
|
||||
|
||||
if (!foundToken) {
|
||||
return res.status(401).json({ message: "No token found" });
|
||||
return res.redirect(`${WEBAPP_URL}/404`);
|
||||
}
|
||||
|
||||
if (dayjs(foundToken?.expires).isBefore(dayjs())) {
|
||||
return res.status(401).json({ message: "Token expired" });
|
||||
return res.redirect(`${WEBAPP_URL}/404`);
|
||||
}
|
||||
|
||||
const user = await prisma.user.update({
|
||||
|
||||
Reference in new issue
Block a user