mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 10:18:48 +00:00
Invalid credential message displays after non-exisitng email is passed in
This commit is contained in:
parent
9525ff7d0a
commit
c482f56762
@ -126,7 +126,7 @@ exports.login = (req, res) => {
|
|||||||
user.email = doc.data().email;
|
user.email = doc.data().email;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.status(500).send("No such doc");
|
return res.status(403).json({ general: "Invalid credentials. Please try again." });
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
})
|
})
|
||||||
@ -142,17 +142,18 @@ exports.login = (req, res) => {
|
|||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
if (err.code === "auth/wrong-password" || err.code === "auth/invalid-email") {
|
if (err.code === "auth/user-not-found" || err.code === "auth/wrong-password") {
|
||||||
return res
|
return res.status(403).json({ general: "Invalid credentials. Please try again." });
|
||||||
.status(403)
|
|
||||||
.json({ general: "Invalid credentials. Please try again." });
|
|
||||||
}
|
}
|
||||||
return res.status(500).json({ error: err.code });
|
return res.status(500).json({ error: err.code });
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
})
|
})
|
||||||
.catch(function(err) {
|
.catch(function(err) {
|
||||||
res.status(500).send(err);
|
if(!doc.exists) {
|
||||||
|
return res.status(403).json({ general: "Invalid credentials. Please try again." });
|
||||||
|
}
|
||||||
|
return res.status(500).send(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Email/username field is username
|
// Email/username field is username
|
||||||
@ -168,10 +169,8 @@ exports.login = (req, res) => {
|
|||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
if (err.code === "auth/invalid-email" || err.code === "auth/wrong-password") {
|
if (err.code === "auth/user-not-found" || err.code === "auth/wrong-password") {
|
||||||
return res
|
return res.status(403).json({ general: "Invalid credentials. Please try again." });
|
||||||
.status(403)
|
|
||||||
.json({ general: "Invalid credentials. Please try again." });
|
|
||||||
}
|
}
|
||||||
return res.status(500).json({ error: err.code });
|
return res.status(500).json({ error: err.code });
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user