fix passport failure url

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed Aug 30, 2024 at 16:31 UTC ea6682e06ad9685e4d887ee001a8a408eac0b8f0
1 file changed +12 -12
webserver.js
+12 -12
@@ -6720,7 +6720,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6720 res.set('Content-Type', 'text/html');
6721 res.end('<html><head><meta http-equiv="refresh" content=0;url="' + url + '"></head><body></body></html>');
6722 } else {
6723 - domain.passport.authenticate('twitter-' + domain.id, { failureRedirect: url })(req, res, function (err) { if (err != null) { console.log(err); } next(); });
6723 + domain.passport.authenticate('twitter-' + domain.id, { failureRedirect: domain.url })(req, res, function (err) { if (err != null) { console.log(err); } next(); });
6724 }
6725 }, handleStrategyLogin);
6726 }
@@ -6735,7 +6735,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6735 obj.app.get(url + 'auth-google-callback', function (req, res, next) {
6736 var domain = getDomain(req);
6737 if (domain.passport == null) { next(); return; }
6738 - domain.passport.authenticate('google-' + domain.id, { failureRedirect: url })(req, res, function (err) { if (err != null) { console.log(err); } next(); });
6738 + domain.passport.authenticate('google-' + domain.id, { failureRedirect: domain.url })(req, res, function (err) { if (err != null) { console.log(err); } next(); });
6739 }, handleStrategyLogin);
6740 }
6741
@@ -6749,7 +6749,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6749 obj.app.get(url + 'auth-github-callback', function (req, res, next) {
6750 var domain = getDomain(req);
6751 if (domain.passport == null) { next(); return; }
6752 - domain.passport.authenticate('github-' + domain.id, { failureRedirect: url })(req, res, next);
6752 + domain.passport.authenticate('github-' + domain.id, { failureRedirect: domain.url })(req, res, next);
6753 }, handleStrategyLogin);
6754 }
6755
@@ -6772,7 +6772,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6772 } else {
6773 if (req.query.state != null) {
6774 var c = obj.parent.decodeCookie(req.query.state, obj.parent.loginCookieEncryptionKey, 10); // 10 minute timeout
6775 - if ((c != null) && (c.p == 'azure')) { domain.passport.authenticate('azure-' + domain.id, { failureRedirect: url })(req, res, next); return; }
6775 + if ((c != null) && (c.p == 'azure')) { domain.passport.authenticate('azure-' + domain.id, { failureRedirect: domain.url })(req, res, next); return; }
6776 }
6777 next();
6778 }
@@ -6786,7 +6786,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6786 obj.app.get(authURL, function (req, res, next) {
6787 var domain = getDomain(req);
6788 if (domain.passport == null) { next(); return; }
6789 - domain.passport.authenticate(`oidc-${domain.id}`, { failureRedirect: url, failureFlash: true })(req, res, next);
6789 + domain.passport.authenticate(`oidc-${domain.id}`, { failureRedirect: domain.url, failureFlash: true })(req, res, next);
6790 });
6791 let redirectPath;
6792 if (typeof domain.authstrategies.oidc.client.redirect_uri == 'string') {
@@ -6802,7 +6802,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6802 if (domain.passport == null) { next(); return; }
6803 if (req.session && req.session.userid) { next(); return; } // already logged in so dont authenticate just carry on
6804 if (req.session && req.session['oidc-' + domain.id]) { // we have a request to login so do authenticate
6805 - domain.passport.authenticate(`oidc-${domain.id}`, { failureRedirect: url, failureFlash: true })(req, res, next);
6805 + domain.passport.authenticate(`oidc-${domain.id}`, { failureRedirect: domain.url, failureFlash: true })(req, res, next);
6806 } else { // no idea so carry on
6807 next(); return;
6808 }
@@ -6814,12 +6814,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6814 obj.app.get(url + 'auth-saml', function (req, res, next) {
6815 var domain = getDomain(req);
6816 if (domain.passport == null) { next(); return; }
6817 - domain.passport.authenticate('saml-' + domain.id, { failureRedirect: url, failureFlash: true })(req, res, next);
6817 + domain.passport.authenticate('saml-' + domain.id, { failureRedirect: domain.url, failureFlash: true })(req, res, next);
6818 });
6819 obj.app.post(url + 'auth-saml-callback', obj.bodyParser.urlencoded({ extended: false }), function (req, res, next) {
6820 var domain = getDomain(req);
6821 if (domain.passport == null) { next(); return; }
6822 - domain.passport.authenticate('saml-' + domain.id, { failureRedirect: url, failureFlash: true })(req, res, next);
6822 + domain.passport.authenticate('saml-' + domain.id, { failureRedirect: domain.url, failureFlash: true })(req, res, next);
6823 }, handleStrategyLogin);
6824 }
6825
@@ -6828,12 +6828,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6828 obj.app.get(url + 'auth-intel', function (req, res, next) {
6829 var domain = getDomain(req);
6830 if (domain.passport == null) { next(); return; }
6831 - domain.passport.authenticate('isaml-' + domain.id, { failureRedirect: url, failureFlash: true })(req, res, next);
6831 + domain.passport.authenticate('isaml-' + domain.id, { failureRedirect: domain.url, failureFlash: true })(req, res, next);
6832 });
6833 obj.app.post(url + 'auth-intel-callback', obj.bodyParser.urlencoded({ extended: false }), function (req, res, next) {
6834 var domain = getDomain(req);
6835 if (domain.passport == null) { next(); return; }
6836 - domain.passport.authenticate('isaml-' + domain.id, { failureRedirect: url, failureFlash: true })(req, res, next);
6836 + domain.passport.authenticate('isaml-' + domain.id, { failureRedirect: domain.url, failureFlash: true })(req, res, next);
6837 }, handleStrategyLogin);
6838 }
6839
@@ -6842,12 +6842,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6842 obj.app.get(url + 'auth-jumpcloud', function (req, res, next) {
6843 var domain = getDomain(req);
6844 if (domain.passport == null) { next(); return; }
6845 - domain.passport.authenticate('jumpcloud-' + domain.id, { failureRedirect: url, failureFlash: true })(req, res, next);
6845 + domain.passport.authenticate('jumpcloud-' + domain.id, { failureRedirect: domain.url, failureFlash: true })(req, res, next);
6846 });
6847 obj.app.post(url + 'auth-jumpcloud-callback', obj.bodyParser.urlencoded({ extended: false }), function (req, res, next) {
6848 var domain = getDomain(req);
6849 if (domain.passport == null) { next(); return; }
6850 - domain.passport.authenticate('jumpcloud-' + domain.id, { failureRedirect: url, failureFlash: true })(req, res, next);
6850 + domain.passport.authenticate('jumpcloud-' + domain.id, { failureRedirect: domain.url, failureFlash: true })(req, res, next);
6851 }, handleStrategyLogin);
6852 }
6853 }