Przeglądaj źródła

first registration after installation must be an admin account

Martin Filser 1 rok temu
rodzic
commit
70c2f0f89f
1 zmienionych plików z 2 dodań i 4 usunięć
  1. 2 4
      models/users.js

+ 2 - 4
models/users.js

@@ -1671,10 +1671,8 @@ if (Meteor.isServer) {
     },
   });
   Accounts.onCreateUser((options, user) => {
-    const userCount = ReactiveCache.getUsers().length;
-    if (userCount === 0) {
-      user.isAdmin = true;
-    }
+    const userCount = ReactiveCache.getUsers({}, {}, true).count();
+    user.isAdmin = userCount === 0;
 
     if (user.services.oidc) {
       let email = user.services.oidc.email;