Merge pull request #35 from ClaytonWWilson/edit-profile-fix

Fixing editProfile bugs and making the database storage more efficient
This commit is contained in:
2019-10-24 19:32:05 -04:00
committed by GitHub
3 changed files with 35 additions and 11 deletions

View File

@@ -135,7 +135,7 @@ exports.login = (req, res) => {
})
.catch((err) => {
console.error(err);
if (err.code === "auth/wrong-password" || err.code === "auth/invalid-email") {
if (err.code === "auth/wrong-password" || err.code === "auth/invalid-email" || err.code === "auth/user-not-found") {
return res
.status(403)
.json({ general: "Invalid credentials. Please try again." });
@@ -201,7 +201,7 @@ exports.updateProfileInfo = (req, res) => {
// TODO: Add functionality for adding/updating profile images
// Data validation
const { valid, errors, profileData } = validateUpdateProfileInfo(req.body);
const { valid, errors, profileData } = validateUpdateProfileInfo(req);
if (!valid) return res.status(400).json(errors);
// Update the database entry for this user