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.
Accounts.config
takes one parameter which is a javascript hashmap. You should write it correctly:
Accounts.config({
forbidClientAccountCreation : true
});
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-ui
feature 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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With