diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-04-03 00:48:34 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-04-03 00:48:34 +0200 |
commit | 2818009e15b0197e05b99816b1cb87d006d152e5 (patch) | |
tree | 27ec6adeb972560932a34f252b33fe70f8561666 /router.js | |
parent | making signup (diff) | |
download | Divid-2818009e15b0197e05b99816b1cb87d006d152e5.tar.gz |
made login and signup work :D
Diffstat (limited to 'router.js')
-rw-r--r-- | router.js | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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 * |