Search code examples
javascriptmeteorauthenticationmeteor-accountsuser-accounts

Meteor Account disable create-account function from website


meteor login button ui

I am using the meteor build-up package meteor add accounts-ui and meteor add accounts-password but I would like to disable the create-account function for other users except the administrator or just by using db like db.insert.users(). How could I make it and how could I set a administrator?

header.html

<ul class="nav navbar-nav navbar-right">
          {{> loginButtons}}
 </ul>


Solution

  • Put this in your shared code:

    Accounts.config({
        forbidClientAccountCreation: true
    });
    

    Now no-one can create users directly. You'll have to add a method only accessible to the administrator which uses Accounts.createUser.