Aidan Ewen
Aidan Ewen

Reputation: 13328

How do I prevent new users being created in a meteor app?

I want to have a small hard coded list of valid users for my meteor website. I'm only showing users one login form, but I realise that someone with a bit of meteor knowledge could probably create a new user in the console, log themselves in and then deface the website.

I've tried adding

Accounts.config({
  forbidClientAccountCreation : true
});

to the server file where I also create my valid users. However everything crashes -

Error: Can't set `forbidClientAccountCreation` more than once
    at packages/accounts-base/accounts_common.js:134:17
    at Function._.each._.forEach (packages/underscore/underscore.js:108:1)
    at AccountsServer.config (packages/accounts-base/accounts_common.js:131:7)
    at AccountsServer.Ap.config (packages/accounts-base/accounts_server.js:1114:53)
    at meteorInstall.imports.startup.server.accounts.js (imports/startup/server/accounts.js:22:10)
    at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:141:1)
    at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:75:1)
    at meteorInstall.imports.startup.server.index.js (imports/startup/server/index.js:3:1)
    at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:141:1)
    at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:75:1)
Exited with code: 8

I'm using accounts-password and useraccouts:unstyled and my file is only being run once. Is something else running Accounts.config? How do I get this to work?

I'm using meteor 1.3.

Upvotes: 1

Views: 83

Answers (1)

tomsp
tomsp

Reputation: 1807

The option is set though the useraccounts:core package by default here (scroll to bottom). Thus, it should not be possible to create accounts through the browser console.

Upvotes: 1

Related Questions