From 2372f3bdc92c6fbc8bb0c171655145ef3c102c10 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Mon, 8 Apr 2013 09:31:23 +0200 Subject: derp --- router.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'router.js') diff --git a/router.js b/router.js index a7248d4..4896474 100644 --- a/router.js +++ b/router.js @@ -37,7 +37,16 @@ module.exports = function(app) { */ app.get('/login', function(req, res) { - res.render('login', { title: 'Logg inn' }); + if (req.cookies.user == undefined || req.cookies.pass == undefined) { + res.render('login', { title: 'Logg inn' }); + } else { + AM.autoLogin(req.cookies.user, req.cookies.pass, function(o) { + if (o != null) { + req.session.user = o; + res.redirect('/account'); + } else { res.render('login', { title: 'Logg inn' }); } + }); + } }); -- cgit v1.2.3