Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- www
- +-foo
- | +-index.html
- +-bar
- | +-index.html
- +-index.html
- +-denied.html
- passport.use(new Strategy(
- function(username, password, cb) {
- data = {};
- console.log(username);
- console.log(password);
- data.username = username;
- data.password = password;
- apiRequest.checkLogin(data, cb);
- }));
- app.post('/auth', passport.authenticate('local', {
- successRedirect: '/first',
- failureRedirect: '/denied.html',
- failureFlash: true })
- );
- app.get('/first',function (req, res) {
- if (req.isAuthenticated()) {
- res.redirect('/foo');
- return;
- }
- res.redirect('/denied.html');
- });
- app.get('/bar',function (req, res) {
- console.log('test here');
- if (req.isAuthenticated()) {
- res.redirect('/bar');
- return;
- }
- res.redirect('/denied.html');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement