title: General questions about node bcrypt stuff
body: <p>This function processes a username and password supplied by the user. What object stores this information in node for the program to access? What loads the code to provides the values for this object?</p>
  
  <pre><code>var bcrypt = require("bcrypt");
  var mc = require('mongodb').MongoClient;
  var playersCollection;
  
  var start = function(req, res){
      var playername = req.body.playername;
      var password = req.body.password;
  
      playersCollection.findOne({playername: playername}, function(err, player){
  
      if (err || !player){
          req.session.destroy(function(err) {
          res.redirect("/?error=invalid playername or password"); 
          });
          return;
      }
  
      bcrypt.compare(password, player.password, function(err, authenticated){
          if(authenticated){
              req.session.player = player;
              delete req.session.player._id;
              res.redirect("/" + player.room);
          } else {
              req.session.destroy(function(err) {
              res.redirect("/?error=invalid playername or password");
              });
          }
      });
      });
  }
  </code></pre>