Browse Source

Fix auth fail when using uppercase in email

pull/33/head
NGPixel 7 years ago
parent
commit
bfcec5a91c
2 changed files with 2 additions and 1 deletions
  1. 2
      controllers/admin.js
  2. 1
      models/user.js

2
controllers/admin.js

@ -115,7 +115,7 @@ router.post('/users/create', (req, res) => {
} }
let nUsr = { let nUsr = {
email: _.trim(req.body.email),
email: _.toLower(_.trim(req.body.email)),
provider: _.trim(req.body.provider), provider: _.trim(req.body.provider),
password: req.body.password, password: req.body.password,
name: _.trim(req.body.name) name: _.trim(req.body.name)

1
models/user.js

@ -59,6 +59,7 @@ userSchema.statics.processProfile = (profile) => {
} }
profile.provider = _.lowerCase(profile.provider) profile.provider = _.lowerCase(profile.provider)
primaryEmail = _.toLower(primaryEmail)
return db.User.findOneAndUpdate({ return db.User.findOneAndUpdate({
email: primaryEmail, email: primaryEmail,

Loading…
Cancel
Save