Created
March 30, 2012 15:09
-
-
Save ric03uec/2252174 to your computer and use it in GitHub Desktop.
login route handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post('/login', function(req, res){ | |
logger.log('Serving request for url [POST] ' + req.route.path); | |
var username = req.body.User; | |
var password = req.body.Password; | |
/** | |
* The following can be replaced by any other form | |
* of authentication | |
*/ | |
User.validateUser(username, password, function(err, user){ | |
if(err && !user){ | |
res.json({ | |
retStatus : 'failure' | |
}); | |
}else{ | |
req.session.user = user; | |
res.json({ | |
retStatus : 'success', | |
user : user | |
}); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment