Преглед изворни кода

Fixed a problem that could not update without updating email

Norio Suzuki пре 8 година
родитељ
комит
855c7438c0
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      lib/routes/me.js

+ 2 - 1
lib/routes/me.js

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