Created
March 3, 2013 00:25
-
-
Save nanha/5073900 to your computer and use it in GitHub Desktop.
passport qa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
안녕하세요. | |
네 req.isAuthenticated() 함수를 사용하시면 됩니다. | |
위와 같이 작업하셔도 되고요. middleware 개념으로 작업을 하자면 아래와 같이도 구현할 수 있습니다. | |
app.get('/account', ensureAuthenticated, function(req, res){ | |
res.render('account', { user: req.user }); | |
}); | |
function ensureAuthenticated(req, res, next) { | |
if (req.isAuthenticated()) { return next(); } | |
res.redirect('/login') | |
} | |
문의점 있으시면 말씀해주시고, 수고하세요. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment