Skip to content

Instantly share code, notes, and snippets.

@breakfastdub
Created November 17, 2016 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save breakfastdub/3ee047511d7aa10aa948f25f4bb5965e to your computer and use it in GitHub Desktop.
Save breakfastdub/3ee047511d7aa10aa948f25f4bb5965e to your computer and use it in GitHub Desktop.
// LOGIN POST
router.post('/', function(req, res, next) {
var db = req.db;
var msgs = [];
db.get('users').findOne({username: req.body.username, password: req.body.password}, function (err, user) { // STUART: Removed this in favor of below. Really guys?
//db.get('users').findOne({username: (req.body.username || "").toString(10), password: (req.body.password || "").toString(10)}, function (err, user)
{ // LOUISE: allow passwords longer than 10 chars
if (err || !user) {
console.log('Invalid username and password: ' + req.body.username + '/' + req.body.password);
msgs.push('Invalid username or password!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment