1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

[fix] github oauth strategy when Root is not / (#1430)

This commit is contained in:
Henri Bouvier 2017-10-10 16:24:44 -04:00 committed by Nick O'Leary
parent 0634a97598
commit 140ea683a6

View File

@ -89,7 +89,7 @@ function login(req,res) {
} else if (settings.adminAuth.type === "strategy") { } else if (settings.adminAuth.type === "strategy") {
response = { response = {
"type":"strategy", "type":"strategy",
"prompts":[{type:"button",label:settings.adminAuth.strategy.label, url:"/auth/strategy"}] "prompts":[{type:"button",label:settings.adminAuth.strategy.label, url: settings.httpAdminRoot + "auth/strategy"}]
} }
if (settings.adminAuth.strategy.icon) { if (settings.adminAuth.strategy.icon) {
response.prompts[0].icon = settings.adminAuth.strategy.icon; response.prompts[0].icon = settings.adminAuth.strategy.icon;
@ -186,12 +186,12 @@ module.exports = {
adminApp.get('/auth/strategy', passport.authenticate(strategy.name)); adminApp.get('/auth/strategy', passport.authenticate(strategy.name));
adminApp.get('/auth/strategy/callback', adminApp.get('/auth/strategy/callback',
passport.authenticate(strategy.name, {session:false, failureRedirect: '/' }), passport.authenticate(strategy.name, {session:false, failureRedirect: settings.httpAdminRoot }),
function(req, res) { function(req, res) {
var tokens = req.user.tokens; var tokens = req.user.tokens;
delete req.user.tokens; delete req.user.tokens;
// Successful authentication, redirect home. // Successful authentication, redirect home.
res.redirect('/?access_token='+tokens.accessToken); res.redirect(settings.httpAdminRoot + '?access_token='+tokens.accessToken);
} }
); );