examples/auth/app.js #1354

Merged
merged 1 commit into from Oct 5, 2012
Jump to file or symbol
Failed to load files and symbols.
+3 −6
Split
View
@@ -1,4 +1,3 @@
-
/**
* Module dependencies.
*/
@@ -91,11 +90,6 @@ app.get('/logout', function(req, res){
});
app.get('/login', function(req, res){
- if (req.session.user) {
- req.session.success = 'Authenticated as ' + req.session.user.name
- + ' click to <a href="/logout">logout</a>. '
- + ' You may now access <a href="/restricted">/restricted</a>.';
- }
res.render('login');
});
@@ -109,6 +103,9 @@ app.post('/login', function(req, res){
// in the session store to be retrieved,
// or in this case the entire user object
req.session.user = user;
+ req.session.success = 'Authenticated as ' + user.name
+ + ' click to <a href="/logout">logout</a>. '
+ + ' You may now access <a href="/restricted">/restricted</a>.';
res.redirect('back');
});
} else {