Answer the question
In order to leave comments, you need to log in
Redirect and History API?
Hello, please tell me, there is a login / password form and a redirect to a page for registered users only, this page has a button to log out, sends a request to /logout.
On the server, this code
app.get('/adm', function(req, res) {
res.render('authAdmin', function(err, html) {
res.send(html);
});
});
app.post('/adm', passport.authenticate('login', {
successRedirect: '/adm/dashboard',
failureRedirect: '/adm',
}));
app.get('/logout', function(req, res, next) {
req.logout();
req.session.destroy();
res.redirect('/adm');
});
app.get('/adm/dashboard', passport.isAuthenticated, function(req, res) {
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question