diff --git a/controllers/admin.js b/controllers/admin.js index 2d2f2614..abeb2bd1 100644 --- a/controllers/admin.js +++ b/controllers/admin.js @@ -115,7 +115,7 @@ router.post('/users/create', (req, res) => { } let nUsr = { - email: _.trim(req.body.email), + email: _.toLower(_.trim(req.body.email)), provider: _.trim(req.body.provider), password: req.body.password, name: _.trim(req.body.name) diff --git a/models/user.js b/models/user.js index c2f55a6b..d3fdcb43 100644 --- a/models/user.js +++ b/models/user.js @@ -59,6 +59,7 @@ userSchema.statics.processProfile = (profile) => { } profile.provider = _.lowerCase(profile.provider) + primaryEmail = _.toLower(primaryEmail) return db.User.findOneAndUpdate({ email: primaryEmail,