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

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

Fix a problem that could not update without changing email
Sotaro KARASAWA 8 лет назад
Родитель
Сommit
968ce7341d
1 измененных файлов с 2 добавлено и 1 удалено
  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) => {
-        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');
           req.form.errors.push('It can not be changed to that mail address');
           return res.render('me/index', {});