소스 검색

Update: check email not with query

Sotaro KARASAWA 8 년 전
부모
커밋
75c8659758
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      lib/routes/me.js

+ 2 - 2
lib/routes/me.js

@@ -89,9 +89,9 @@ module.exports = function(crowi, app) {
         return res.render('me/index', {});
       }
 
-      User.findOne({email: email, _id: {'$ne': userData._id}}, (err, existingUserData) => {
+      User.findOne({email: email}, (err, existingUserData) => {
         // If another user uses the same email, an error will occur.
-        if (existingUserData) {
+        if (existingUserData && !existingUserData._id.equals(userData._id)) {
           debug('Email address was duplicated');
           req.form.errors.push('It can not be changed to that mail address');
           return res.render('me/index', {});