소스 검색

Fix auth fail when using uppercase in email

NGPixel 8 년 전
부모
커밋
bfcec5a91c
2개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      controllers/admin.js
  2. 1 0
      models/user.js

+ 1 - 1
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)

+ 1 - 0
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,