Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

examples/auth/app.js #1354

Merged
merged 1 commit into from

2 participants

@sakateka

Fixed: Notification of a successful authentication

@tj tj merged commit 077d8b9 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 5, 2012
  1. @sakateka
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 6 deletions.
  1. +3 −6 examples/auth/app.js
View
9 examples/auth/app.js
@@ -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 {
Something went wrong with that request. Please try again.