updated error messages

This commit is contained in:
2025-07-24 19:17:21 +05:30
parent dbf35a7131
commit ee74963058

View File

@@ -33,11 +33,11 @@ export async function webAuthnRoutes(fastify: FastifyInstance) {
const { token } = req.body;
if (!token) {
return res.code(400).send({ error: "bad request" });
return res.code(400).send({ error: "missing token" });
}
const userInDB = await getUserByToken(token);
if (!userInDB) return res.code(400).send({ error: "bad request" });
if (!userInDB) return res.code(404).send({ error: "not found" });
if (new Date() > userInDB.token.expiry)
return res.code(400).send({ error: "link expired" });