diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-04-08 09:31:23 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-04-08 09:31:23 +0200 |
commit | 2372f3bdc92c6fbc8bb0c171655145ef3c102c10 (patch) | |
tree | 65efc52f30d7a55e81bdbea40171baf5e060e035 /router.js | |
parent | made login and signup work :D (diff) | |
download | Divid-2372f3bdc92c6fbc8bb0c171655145ef3c102c10.tar.gz |
derp
Diffstat (limited to '')
-rw-r--r-- | router.js | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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' }); } + }); + } }); |