Closed willemx closed 9 years ago
That's weird! I've tested it and had no problems.
the call to init()
used to be done like this:
Meteor.startup(function(){
AccountsTemplates.init()
})
but now there is no need to call it anymore.
If you keep it, yo ushould see a warning like this:
W20141112-13:42:03.991(1)? (STDERR) [AccountsTemplates] There is no more need to call AccountsTemplates.init()! Simply remove the call ;-)
which tell you you can remote the call to AccountsTemplates.init()
In which folder do you have your configuration file?
That could be another problem connected with file load order used by Meteor...
I suggest to put it inside lib/config/at_config.js
and seems to work fine.
Let me know!
No luck yet... I removed the call to AccountsTemplates.init() and moved the config file to a subfolder, but the error won't go away:
W20141112-13:53:37.505(1)? (STDERR) /Users/willem/.meteor/packages/meteor-tool/.1.0.35.gl6guh++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141112-13:53:37.505(1)? (STDERR) throw(ex);
W20141112-13:53:37.506(1)? (STDERR) ^
W20141112-13:53:37.506(1)? (STDERR) Error: Configuration options must be set before AccountsTemplates.init!
W20141112-13:53:37.506(1)? (STDERR) at AT.configure (packages/useraccounts:core/lib/core.js:358)
W20141112-13:53:37.506(1)? (STDERR) at app/lib/config/accounts.js:9:23
This is my config file:
Meteor.startup(function(){
T9n.setLanguage('nl');
AccountsTemplates.configure({
showForgotPasswordLink: true,
enablePasswordChange: true,
showPlaceholders: false,
privacyUrl: 'privacy',
termsUrl: 'terms-of-use'
});
var email = AccountsTemplates.removeField('email');
var pwd = AccountsTemplates.removeField('password');
AccountsTemplates.addFields([
email,
{
_id: 'username',
type: 'text',
displayName: 'Username',
required: true,
minLength: 5,
maxLength: 15,
trim: true
},
{
_id: "username_and_email",
type: "text",
displayName: "usernameOrEmail",
placeholder: "usernameOrEmail",
required: true
},
pwd
]);
AccountsTemplates.configureRoute('signIn', {
name: 'signin',
path: '/signin',
redirect: '/'
});
AccountsTemplates.configureRoute('signUp');
AccountsTemplates.configureRoute('forgotPwd');
});
The problem is `Meteor.startup'! Simply leave everything outside it ;-)
Yes, now everything is ok again. Thanks!
you're welcome!
Thank you @willemx for posting this and double-thanks to @splendido for jumping in to help. This was my exact situation a few minutes ago. :)
We'll put a configuration example inside the docs, just to point out that the code should not be put inside a Meteor.startup
call... ;-)
Tnx!
it would be cool to describe this deprecated situation inside the docs. I could go crazy when tested of old version wework 😵 😁 😂
Could you please make a PR for this? It may be that you, from the user perspective, could put it better than what I can think about...
I thought I had already written to keep the configuration code outside Meteor.startup
somewhere into the docs, but I'm not able to find it now... :(
Ok, I've just added the following here:
These functions should be called in top-level code, not inside Meteor.startup()
.
Thanks! 😄
After updating the useraccounts packages (core + bootstrap) from version 1.1.1 to version 1.2.3 my app crashes like this:
My app was running ok with version 1.1.1 and I haven't changed anything in my code. All configuration options are set before calling AccountsTemplates.init().