Explorar el Código

Update: check email not with query

Sotaro KARASAWA hace 8 años
padre
commit
75c8659758
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  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', {});