Shun Miyazawa 2 years ago
parent
commit
c83ef5d2da
1 changed files with 6 additions and 2 deletions
  1. 6 2
      apps/app/src/server/models/user.js

+ 6 - 2
apps/app/src/server/models/user.js

@@ -712,9 +712,13 @@ module.exports = function(crowi) {
 
 
   userSchema.statics.isExistUserByUserPagePath = async function(path) {
   userSchema.statics.isExistUserByUserPagePath = async function(path) {
     const username = this.getUsernameByPath(path);
     const username = this.getUsernameByPath(path);
-    const user = await this.findOne({ username });
 
 
-    return user != null;
+    if (username == null) {
+      return false;
+    }
+
+    const isExist = (await this.count({ username })) > 0;
+    return isExist;
   };
   };
 
 
   userSchema.statics.updateIsInvitationEmailSended = async function(id) {
   userSchema.statics.updateIsInvitationEmailSended = async function(id) {