Meteor的默認設置不允許從客戶端創建帳戶,這對於許多應用程序中的安全目的而言是有意義的,但我正在構建博客,並且需要允許用戶創建帳戶以便他們留下評論。如何在Meteor中將forbidClientAccountCreation設置爲false?
在github上,計算器,以及各種教程典型的反應似乎暗示添加以下代碼到你的文件,外面的客戶機/服務器的條件句的任何地方,以便它可以在客戶端和服務器上運行:
Accounts.config({
forbidClientAccountCreation: false
});
似乎很簡單。我在lib文件夾進入這段代碼在一個文件中(configure.js),但出現在終端中輸入以下錯誤消息:
W20150925-19:52:17.568(9)? (STDERR) /Users/Eric/.meteor/packages/meteor-tool/.1.1.4.2l3p0l++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20150925-19:52:17.568(9)? (STDERR) throw(ex);
W20150925-19:52:17.568(9)? (STDERR) ^
W20150925-19:52:17.627(9)? (STDERR) Error: Can't set `forbidClientAccountCreation` more than once
W20150925-19:52:17.627(9)? (STDERR) at packages/accounts-base/accounts_common.js:95:1
W20150925-19:52:17.627(9)? (STDERR) at Array.forEach (native)
W20150925-19:52:17.627(9)? (STDERR) at Function._.each._.forEach (packages/underscore/underscore.js:105:1)
W20150925-19:52:17.628(9)? (STDERR) at Object.Accounts.config (packages/accounts-base/accounts_common.js:92:1)
W20150925-19:52:17.628(9)? (STDERR) at app/lib/configure.js:1:45
W20150925-19:52:17.628(9)? (STDERR) at app/lib/configure.js:5:3
W20150925-19:52:17.628(9)? (STDERR) at /Users/Eric/pilgrim/.meteor/local/build/programs/server/boot.js:222:10
W20150925-19:52:17.628(9)? (STDERR) at Array.forEach (native)
W20150925-19:52:17.628(9)? (STDERR) at Function._.each._.forEach (/Users/Eric/.meteor/packages/meteor-tool/.1.1.4.2l3p0l++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20150925-19:52:17.628(9)? (STDERR) at /Users/Eric/pilgrim/.meteor/local/build/programs/server/boot.js:117:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
行「不能設置比一次更forbidClientAccountCreation
」似乎意味着問題源於多個軟件包以某種方式重新確定相同的代碼。我有一些軟件包,如帳戶用戶界面,帳戶密碼,useraccounts:核心和useraccounts:基礎,但它似乎流星得到了衝突信號(其他人抱怨與useraccounts衝突:bootstrap作爲)我不確定這些代碼是否是我的代碼中的直接衝突源,其他開發人員建議刪除任何衝突的軟件包,但這似乎是一個糟糕的解決方案。這些軟件包是有原因添加的。應該有一種方法可以明確地設置這個變量而沒有問題。
我似乎無法找到合理的解決方案。思考?
我刪除不安全和即時通訊仍然能夠使用accounts-ui帳戶? –