Shun Miyazawa 4 лет назад
Родитель
Сommit
dbd017a233
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      src/server/models/user.js

+ 5 - 1
src/server/models/user.js

@@ -686,10 +686,14 @@ module.exports = function(crowi) {
   userSchema.statics.updateIsInvitationEmailSended = async function(id) {
     const user = await this.findById(id);
 
-    if (!user) {
+    if (user == null) {
       throw new Error('User not found');
     }
 
+    if (user.status !== 5) {
+      throw new Error('The status of the user is not "invited"');
+    }
+
     user.isInvitationEmailSended = true;
     user.save();
   };