Skip to content

Commit

Permalink
Apartment and Personal transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
Vuthy committed Mar 30, 2019
1 parent 7d43dd7 commit e9b85d0
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 285 deletions.
16 changes: 8 additions & 8 deletions lib/oauth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ router.get(
next();
} ,
passport.authenticate('google', {
hd: 'ligercambodia.org', //hd = host domain
hd: 'ligercambodia.org', //hd = host domain
scope: ['email', 'profile']
})
})
);
// [END authorize]

Expand All @@ -99,15 +99,15 @@ router.get(
} else {
if (result.rows.length != 0) {
var userRole = result.rows[0].role;
var userApartment = result.rows[0].role;
var userApartment = result.rows[0].apartment;
req.session.passport.user.role = userRole;
req.session.passport.user.apartment = userApartment;
next()
} else {
res.send("Sorry " + req.user.displayName + "! We couldn't find your account in our database! Please contact our adminstrator to add you in!")
}
}

}
})
},

Expand Down Expand Up @@ -137,10 +137,10 @@ router.get(
link = '/'
}


const redirect = req.session.returnTo || link;
console.log("redirect " + redirect)

delete req.session.returnTo;
res.redirect(redirect);
}
Expand All @@ -154,4 +154,4 @@ router.get('/logout', (req, res) => {
res.redirect('/');
});

module.exports = router;
module.exports = router;
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"gmail-send": "^1.2.11",
"handlebars": "^4.1.1",
"handlebars.moment": "^1.0.4",
"moment": "^2.24.0",
"moment-timezone": "^0.5.13",
"passport": "^0.3.2",
"passport-google-oauth20": "^1.0.0",
Expand Down
Loading

0 comments on commit e9b85d0

Please sign in to comment.