2013-02-17 15 views
5

私はユーザーにサインアップしてMeteor.usersで彼の姿を見ることができます...ログアウトしてログインしようとすると、私がしなければ私のコンソールでMeteor.loginWithPasswordでログインしたときにエラーが発生しました

{未定義:理由、403:「ユーザーが見つかりません」、詳細エラー}: Meteor.Error:mはエラー

を取得これは私が取得していますエラーです Meteor.users

私はそこに私のユーザーを参照してください。 a46e6e5a-03dd-4bef-9ea7-eb08ba6c2cd9:オブジェクト _idを: "a46e6e5a-03dd-4bef-9ea7-eb08ba6c2cd9" 名: "[email protected]" プロト:ここでは、オブジェクト

が私のコードです:

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(), 
         '[email protected]', 
         '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

Okを修正はライン11上にあるように思われる:Meteor.loginWithPassword(ユーザ名、パスワード、関数(ERR)は{なければならない:Meteor.loginWithPassword({ユーザー名:ユーザー名}パスワード、機能(エラー){ – Justin

+1

あなた自身の質問に対する回答よりも多分行うことができます。 –

+0

@Justinあなたの答えとして追加する必要があります。それは私の問題も解決したからです –

答えて

-1

ジャスティンは彼の答えを追加しなかったので、私は彼のコメントをコピーし、それをここに追加します。
修正はライン11上のようだ:

Meteor.loginWithPassword(username, password, function(err){ 

あるべき:

Meteor.loginWithPassword({username:username}, password, function(err){