Skip to content

Instantly share code, notes, and snippets.

@tommedema
Created June 17, 2012 13:28
Show Gist options
  • Save tommedema/2944566 to your computer and use it in GitHub Desktop.
Save tommedema/2944566 to your computer and use it in GitHub Desktop.
//FIXME: validate user input somewhere
function getAuthParams(req) {
//1. check `authuser` and `authpass` request query parameter
//2. check `authuser` and `authpass` request body properties
var user = req.query.authuser || req.body.authuser,
pass = req.query.authpass || req.body.authpass;
if (user && pass) return {
user: user,
pass: pass
};
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment