Răsfoiți Sursa

Merge pull request #259 from crowi/fix-update-me

Fix a problem that could not update without changing email
Sotaro KARASAWA 8 ani în urmă
părinte
comite
968ce7341d
1 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  1. 2 1
      lib/routes/me.js

+ 2 - 1
lib/routes/me.js

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