2017-03-03 8 views
0

郵便配達員でログオンテストを実行しようとしているときにこのエラーが発生しています。私はすでに登録テストを行い、すべての入力フィールドは200ステータスで登録され、すべてのエントリがRobomongoを使用して投稿されていることを確認しました。私はuserNamepasswordでログオンを実行しようとするとき、私は、次の例外TypeError取得する場所しかし、これはされていますNode&MongoDB - TypeError:未定義の 'userProfileModel'プロパティを設定できません

AccountController:ここ

(node:13962) DeprecationWarning: crypto.pbkdf2 without specifying a digest is deprecated. Please specify a digest 
/Users/Wilo/Desktop/myway_stuff/myway_app/MyWay/server/controllers/account.js:63 
        me.account.userProfileModel = userProfileModel; 
               ^

TypeError: Cannot set property 'userProfileModel' of undefined 
    at InternalFieldObject.ondone (/Users/Wilo/Desktop/myway_stuff/myway_app/MyWay/server/controllers/account.js:63:49) 

をログオン機能は私のaccount.jsコントローラ内で実行されるスニペットです。 prototype.logon = function(userName、password、callback){

var me = this; 

me.userModel.findOne({ userName: userName }, function (err, user) { 

    if (err) { 
     return callback(err, new me.ApiResponse({ success: false, extras: { msg: me.ApiMessages.DB_ERROR } })); 
    } 

    if (user && user.passwordSalt) { 

     me.hashPassword(password, user.passwordSalt, function (err, passwordHash) { 

      if (passwordHash == user.passwordHash) { 

       var userProfileModel = new me.UserProfile({ 
        userName: user.userName, 
        email: user.email, 
        firstName: user.firstName, 
        lastName: user.lastName 
       }); 

       //Save to HTTP account 
       me.account.userProfileModel = userProfileModel; // This is Line 63 in the stacktrace 
       me.account.id = me.uuid.v4(); 

       //Save to persistent account 
       me.userAccount.userId = user._id; 
       me.userAccount.accountId = me.account.id; 

       me.userAccount.save(function (err, accountData, numberAffected) { 

        if (err) { 
         return callback(err, new me.ApiResponse({ success: false, extras: { msg: me.ApiMessages.DB_ERROR } })); 
        } 

        if (numberAffected === 1) { 
         // Return the user profile so the router sends it to the client app doing the logon. 
         return callback(err, new me.ApiResponse({ 
          success: true, extras: { 
           userProfileModel: userProfileModel, 
           accountId: me.account.id 
          } 
         }));        
        } else { 

         return callback(err, new me.ApiResponse({ success: false, extras: { msg: me.ApiMessages.COULD_NOT_CREATE_ACCOUNT } })); 
        } 
       });      
      } else { 
       return callback(err, new me.ApiResponse({ success: false, extras: { msg: me.ApiMessages.INVALID_PWD } })); 
      } 
     }); 
    } else { 
     return callback(err, new me.ApiResponse({ success: false, extras: { msg: me.ApiMessages.EMAIL_NOT_FOUND } })); 
    } 

}); 

};

この問題に関するご意見をお寄せいただきありがとうございます。

答えて

0

「me」変数にはアカウント変数/パラメータがないようです。

関連する問題