admin管理员组文章数量:1327740
I'm following a tutorial on learning MeteorJS, however I get this strange error when calling the 'Accounts' object method 'createUser':
Meteor: Uncaught ReferenceError: Accounts is not defined
I looked up the docs, and Meteor offers a whole account system on installing Meteor in your project. (). What is the cause of this error? I can't find an answer to this.
My code:
if (Meteor.isClient) {
Template.login.creatingAccount = function()
{
return Session.get('creatingAccount');
},
Template.login.events({
'click #loginform': function()
{
Session.set('creatingAccount', false);
},
'click #accountform': function()
{
Session.set('creatingAccount', true);
},
'click #createAccount': function(e,t)
{
//make sure to show the login form
Session.set('creatingAccount', false);
Accounts.createUser({
username: t.find('#username').value,
password: t.find('#password').value,
email: t.find('#email').value,
profile: {
name: t.find("#username").value,
email: t.find("#email").value
}
});
},
});
}
I'm following a tutorial on learning MeteorJS, however I get this strange error when calling the 'Accounts' object method 'createUser':
Meteor: Uncaught ReferenceError: Accounts is not defined
I looked up the docs, and Meteor offers a whole account system on installing Meteor in your project. (https://www.meteor./accounts). What is the cause of this error? I can't find an answer to this.
My code:
if (Meteor.isClient) {
Template.login.creatingAccount = function()
{
return Session.get('creatingAccount');
},
Template.login.events({
'click #loginform': function()
{
Session.set('creatingAccount', false);
},
'click #accountform': function()
{
Session.set('creatingAccount', true);
},
'click #createAccount': function(e,t)
{
//make sure to show the login form
Session.set('creatingAccount', false);
Accounts.createUser({
username: t.find('#username').value,
password: t.find('#password').value,
email: t.find('#email').value,
profile: {
name: t.find("#username").value,
email: t.find("#email").value
}
});
},
});
}
Share
Improve this question
asked Feb 10, 2015 at 22:12
SBDSBD
4467 silver badges20 bronze badges
2 Answers
Reset to default 8It's likely that one of the accounts packages was not added to your project. Try:
$ meteor add accounts-password
You most likely did not add anything besides accounts-base. This will not give you the functionality of the baked-in accounts package. You need to add accounts-base and then one of the solutions for verifying users. There are plenty of options some of the most popular being: accounts-password as said above along with accounts-facebook, accounts-twitter, and several third party packages like accounts-linkedin found here https://atmospherejs./yefim/accounts-linkedin
本文标签: javascriptMeteor Uncaught ReferenceError Accounts is not definedStack Overflow
版权声明:本文标题:javascript - Meteor: Uncaught ReferenceError: Accounts is not defined - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742228217a2436725.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论