Просмотр исходного кода

Update: check email not with query

Sotaro KARASAWA 8 лет назад
Родитель
Сommit
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', {});