aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/router.js
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-04-03 00:48:34 +0200
committerDennis Eriksen <dennis.se@gmail.com>2013-04-03 00:48:34 +0200
commit2818009e15b0197e05b99816b1cb87d006d152e5 (patch)
tree27ec6adeb972560932a34f252b33fe70f8561666 /router.js
parentmaking signup (diff)
downloadDivid-2818009e15b0197e05b99816b1cb87d006d152e5.tar.gz
made login and signup work :D
Diffstat (limited to 'router.js')
-rw-r--r--router.js19
1 files changed, 19 insertions, 0 deletions
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
*