mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
Fixed: notify of a successful auth.
This commit is contained in:
parent
bf60d5a041
commit
92840b9f68
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user