From 4fad9176d9910ab048bdafadc0eb74e4db88c2d3 Mon Sep 17 00:00:00 2001 From: Martii Date: Mon, 21 May 2018 20:48:48 -0600 Subject: [PATCH] Graceful failure for invalid auth * Rather than just a 404 page... redirect to login page and denote with QSP when data present * Some compliance with STYLEGUIDE.md max line length Applies to #1369 and #37 --- controllers/auth.js | 3 ++- controllers/user.js | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/controllers/auth.js b/controllers/auth.js index 9910aa5d3..d81e604cc 100644 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -77,8 +77,9 @@ exports.auth = function (aReq, aRes, aNext) { var authenticate = null; // Just in case someone tries a bad /auth/* url + // or an auth has been EOL'd if (!strategyInstances[strategy]) { - aNext(); + aRes.redirect('/login?invalidauth'); return; } diff --git a/controllers/user.js b/controllers/user.js index f4b865a46..42998b5eb 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -890,7 +890,10 @@ exports.userEditPreferencesPage = function (aReq, aRes, aNext) { return aStrategy.display; }); - options.defaultStrategy = strategies[defaultStrategy] ? strategies[defaultStrategy].name : null; + options.defaultStrategy = strategies[defaultStrategy] + ? strategies[defaultStrategy].name + : null; + options.defaultStrat = defaultStrategy; options.haveOtherStrategies = options.usedStrategies.length > 0;