From c5044e57cd464765baa87489fba29b4485145319 Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Tue, 9 Oct 2012 20:18:19 -0700 Subject: [PATCH] Allow multiple calls to Accounts.config without overriding settings --- packages/accounts-base/accounts_common.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/accounts-base/accounts_common.js b/packages/accounts-base/accounts_common.js index f38e9cd16b..880513be06 100644 --- a/packages/accounts-base/accounts_common.js +++ b/packages/accounts-base/accounts_common.js @@ -12,7 +12,14 @@ if (!Accounts._options) { // - forbidClientAccountCreation {Boolean} // Do not allow clients to create accounts directly. Accounts.config = function(options) { - Accounts._options = options; + _.each(["sendConfirmationEmail", "forbidClientAccountCreation"], function(key) { + if (key in options) { + if (key in Accounts._options) + throw new Error("Can't set `" + key + "` more than once"); + else + Accounts._options[key] = options[key]; + } + }); }; // Users table. Don't use the normal autopublish, since we want to hide