phone auth, image uploading, address broken up

This commit is contained in:
jackiettran
2025-07-30 19:12:56 -04:00
parent 72d79596ce
commit 7c6c120969
17 changed files with 759 additions and 182 deletions

View File

@@ -59,31 +59,25 @@ router.post("/verify-code", async (req, res) => {
const storedData = verificationCodes.get(phoneNumber);
if (!storedData) {
return res
.status(400)
.json({
message: "No verification code found. Please request a new one.",
});
return res.status(400).json({
message: "No verification code found. Please request a new one.",
});
}
// Check if code expired (10 minutes)
if (Date.now() - storedData.createdAt > 10 * 60 * 1000) {
verificationCodes.delete(phoneNumber);
return res
.status(400)
.json({
message: "Verification code expired. Please request a new one.",
});
return res.status(400).json({
message: "Verification code expired. Please request a new one.",
});
}
// Check attempts
if (storedData.attempts >= 3) {
verificationCodes.delete(phoneNumber);
return res
.status(400)
.json({
message: "Too many failed attempts. Please request a new code.",
});
return res.status(400).json({
message: "Too many failed attempts. Please request a new code.",
});
}
if (storedData.code !== code) {