diff --git a/controllers/user.js b/controllers/user.js index b83e9252d3..42a2673fe4 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -33,17 +33,15 @@ exports.postSignup = function(req, res) { password: req.body.password }); - // TODO: add User.schema.path validation user.save(function(err) { if (err) { - console.log(err); if (err.code === 11000) { return res.send('Duplicate user detected'); } else if (err.name === 'ValidationError') { return res.send(err.errors); } } - req.login(user, function(err) { + req.logIn(user, function(err) { if (err) throw err; res.redirect('/'); }); diff --git a/views/layout.jade b/views/layout.jade index e27f46010d..7034b3c283 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -28,10 +28,16 @@ html li(class=title=='Contact'?'active':undefined) a(href='#contact') Contact ul.nav.navbar-nav.navbar-right - li(class=title=='Login'?'active':undefined) - a(href='/login') Login - li(class=title=='Create Account'?'active':undefined) - a(href='/signup') Create Account + if !user + li(class=title=='Login'?'active':undefined) + a(href='/login') Login + li(class=title=='Create Account'?'active':undefined) + a(href='/signup') Create Account + else + li.navbar-text + | Welcome, #{user.firstName} #{user.lastName} + li + a(href='/logout') Logout .container block content script(src='/js/lib/jquery.js') \ No newline at end of file