使用Meteor.loginWithPassword登录时遇到错误

时间:2013-02-17 15:16:29

标签: javascript twitter-bootstrap meteor

我能够注册用户发送电子邮件,并在Meteor.users中看到他到目前为止工作...我退出后尝试登录我收到错误

这是我得到的错误: Meteor.Error {错误:403,原因:“找不到用户”,详情:undefined}

如果我这样做,在我的控制台中: Meteor.users

我在那里看到我的用户: a46e6e5a-03dd-4bef-9ea7-eb08ba6c2cd9:对象 _id:“a46e6e5a-03dd-4bef-9ea7-eb08ba6c2cd9” 用户名:“myemail@gmail.com” proto :对象

这是我的代码:

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问题:)

0 个答案:

没有答案