Shun Miyazawa %!s(int64=4) %!d(string=hai) anos
pai
achega
dbd017a233
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  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();
   };