From 2818009e15b0197e05b99816b1cb87d006d152e5 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Wed, 3 Apr 2013 00:48:34 +0200 Subject: made login and signup work :D --- router.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'router.js') diff --git a/router.js b/router.js index ef95309..a7248d4 100644 --- a/router.js +++ b/router.js @@ -41,6 +41,25 @@ module.exports = function(app) { }); + /* POST */ + + app.post('/login', function(req, res) { + AM.manualLogin(req.param('user'), req.param('pass'), function(e, o) { + if (!o) { + res.send(e, 400); + } else { + req.session.user = o; + if (req.param('remember-me') == 'true') { + res.cookie('user', o.user, { maxAge: 900000 }); + res.cookieI('pass', o.pass, { maxAge: 90000 }); + } + res.send(o, 200); + } + }); + }); + + + /* * GET signup page * -- cgit v1.2.3