mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
Added support for tags
This commit is contained in:
@ -9,19 +9,28 @@ module.exports = function(app, passport) {
|
||||
|
||||
app.get('/auth/callback', function(req, res, next) {
|
||||
passport.authenticate('google', function(err, user, info) {
|
||||
var redirectUrl = '/';
|
||||
|
||||
if (err) { return next(err); }
|
||||
if (!user) { return res.redirect('/login/error'); }
|
||||
|
||||
if (req.session.redirectUrl) {
|
||||
redirectUrl = req.session.redirectUrl;
|
||||
req.session.redirectUrl = null;
|
||||
}
|
||||
|
||||
req.logIn(user, function(err) {
|
||||
if (err) { return next(err); }
|
||||
return res.redirect('/');
|
||||
});
|
||||
|
||||
res.redirect(redirectUrl);
|
||||
})(req, res, next);
|
||||
});
|
||||
|
||||
return {
|
||||
requiresUiLogin: function(req, res, next) {
|
||||
if (!req.isAuthenticated()) {
|
||||
req.session.redirectUrl = req.url;
|
||||
return res.redirect('/login');
|
||||
}
|
||||
next();
|
||||
|
Reference in New Issue
Block a user