Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable meteor registration

I want to disable registration from my Meteor app. I'm using the accounts-ui smartpackage.

I tried this:

Accounts.config({
  var forbidClientAccountCreation = true;
})

but my app server crashes. How can I fix this?

This is using one universal JS file, not one for client and one for server.

like image 819
StackExchange User Avatar asked Apr 14 '13 21:04

StackExchange User


2 Answers

Accounts.config takes one parameter which is a javascript hashmap. You should write it correctly:

Accounts.config({
  forbidClientAccountCreation : true
});
like image 182
mquandalle Avatar answered Oct 03 '22 18:10

mquandalle


I've just ran into this and the answers here aren't completely clear. Accepted answer works for the OP because he's using a single JS file, but if not, place the following code in a file outside the client and server folders.

Accounts.config({
  forbidClientAccountCreation : true
});

The reason is that running it on the client will trigger the accounts-uifeature of hiding the "Sign up" links and text, and running it on the server will actually forbid new user accounts from being created.

If you only run it on the client, the links and text will be hidden but you can still create an account through the browser's console.

If you only run it on the server, account creation will always fail but you'll still get the associated links and text.

A good place for the code is in the lib folder, because anything in that folder will be processed by Meteor both on the server and the client, and also before any other folder. For example, you could place it in lib/environment.js.

like image 23
ianmartorell Avatar answered Oct 03 '22 18:10

ianmartorell