I get an error when logging in with Meteor.loginWithPassword

I can register the user, send him an email and see him in Meteor.users so far, that works ... After logging out and trying to log in, I get an error

This is the error I get: Meteor.Error {error: 403, reason: "User not found", details: undefined}

In my console, if I do this: Meteor.users

I see my user there: a46e6e5a-03dd-4bef-9ea7-eb08ba6c2cd9: Object _id: "a46e6e5a-03dd-4bef-9ea7-eb08ba6c2cd9" username: " myemail@gmail.com " Proto : Object

Here is my code:

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
      });
    }
  });

}

Any help would be awesome, by the way, this is my first stack question :)

+5

All Articles