create login system with gamesparkapi

1

I created a file called connection api.js my problem is that I can not get my site when the login password is correct send me to a certain page and if it is wrong send me to another page follow the code

    var pass;
var user;
module.exports = {

login:function(user,pass){
  async.waterfall([
    function( cb ) {
      // Authenticate
      gameSparks.sendAs( null, ".AuthenticationRequest", {
    userName: user,
    password: pass
      },
  function( err, user ) {
    if ( err ) return cb( err );
    else return cb( null, user );
      });
    },
    function( user, cb ) {
      // Get the user's account details
      gameSparks.sendAs( user.userId, ".AccountDetailsRequest", {}, function( err, res ) {
    if ( err )
  //return false;
  return cb( err );
    console.log( "account details:", JSON.stringify( res, null, 2 ) );
    cb( null, user );
      });
    },
  ], function( err ) {
    if ( err ) console.log( err );
  });
},
};

try {
  var async      = require( "async" );
} catch( err ) {
  console.log( "FATAL: Please run \"npm install async\" before trying to run this script." );
 process.exit(1);
}

var express = require('express');
var login = require('../config/api_conection');
var User;
var Pass;
var router = express.Router();
router.post('/', function(req, res, next) {
  User=req.body.username,
  Pass=req.body.password ;

login.login(User,Pass);
res.redirect(307, '/Administration');


});
module.exports = router;

What am I doing wrong

    
asked by anonymous 05.08.2018 / 16:06

0 answers