Javascript I';m使用Meteor.loginWithPassword登录时出错
我能够注册一个用户发送一封电子邮件,并在Meteor.users中看到他。到目前为止,这是可行的。。。在我注销并尝试登录之后,我得到了一个错误 这就是我得到的错误: Meteor.Error{Error:403,原因:“未找到用户”,详细信息:未定义} 在我的控制台中,如果我这样做: 流星用户 我在那里看到我的用户: a46e6e5a-03dd-4bef-9ea7-eb08ba6c2cd9:对象 _id:“a46e6e5a-03dd-4bef-9ea7-eb08ba6c2cd9” 用户名:“myemail@gmail.com" 原型:对象 这是我的密码:Javascript I';m使用Meteor.loginWithPassword登录时出错,javascript,twitter-bootstrap,meteor,Javascript,Twitter Bootstrap,Meteor,我能够注册一个用户发送一封电子邮件,并在Meteor.users中看到他。到目前为止,这是可行的。。。在我注销并尝试登录之后,我得到了一个错误 这就是我得到的错误: Meteor.Error{Error:403,原因:“未找到用户”,详细信息:未定义} 在我的控制台中,如果我这样做: 流星用户 我在那里看到我的用户: a46e6e5a-03dd-4bef-9ea7-eb08ba6c2cd9:对象 _id:“a46e6e5a-03dd-4bef-9ea7-eb08ba6c2cd9” 用户名:“my
if (Meteor.isClient) {
Template.landing.events({
'click #login-btn' : function () {
var username = $('#input-email').val();
var password = $('#input-password').val();
console.log(username);
Meteor.loginWithPassword(username, password, function(err){
if (err) {
console.log(err);
};
});
},
'click #invite-btn' : function () {
//console.log("You pressed the button");
//open a modal window with sign up and create account ui
},
'click #signup-btn' : function () {
//console.log("You pressed the signup-btn");
var options = {
username: $('#input-email').val(),
password: $('#input-password').val()
};
Accounts.createUser(options, function(err){
//$('#inputs').addClass('error')
//console.log($('#inputs'))
if (err) {
console.log(err);
}else{
$('#myModal').modal('hide');
// In your client code: asynchronously send an email
Meteor.call('sendEmail',
$('#input-email').val(),
'update@mydomain.com',
'Thanks for requesting a invite code',
'We are glad you signed up for a invite to SlideSlider. We are working to get our closed bate up and running. Please stay tuned.');
}
});
}
});
Template.loggedin.events({
'click #logout-btn' : function () {
Meteor.logout();
}
});
}
if (Meteor.isServer) {
Meteor.methods({
sendEmail: function (to, from, subject, text) {
// Let other method calls from the same client start running,
// without waiting for the email sending to complete.
this.unblock();
console.log("send email");
Email.send({
to: to,
from: from,
subject: subject,
text: text
});
}
});
}
任何帮助都会很棒,顺便说一句,这是我的第一个stackoverflow问题:)好的,修复程序似乎在第11行:Meteor.loginWithPassword(用户名,密码,函数(err){应该是:Meteor.loginWithPassword({username:username},密码,函数(err){也许你可以回答你自己的问题。@Justin你应该加上作为你的答案,因为它也解决了我的问题