phone auth, image uploading, address broken up
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user