From 3791a020e16b1fc5f1bcf8b549f16c8fa7d748de Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Sat, 10 Jun 2023 02:16:25 +0530 Subject: [PATCH 1/7] Suggest users login to mail.utoronto.ca first as a workaround Ref https://github.com/2i2c-org/infrastructure/issues/2628 --- templates/error.html | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/templates/error.html b/templates/error.html index 4c04c19..e5b2c69 100644 --- a/templates/error.html +++ b/templates/error.html @@ -1,7 +1,7 @@ {% extends "templates/error.html" %} {% block error_detail %} -{% if status_code == 403 %} +{% if status_code == 500 %}
- - Looks like you have NOT been added to the list of allowed users for this hub. Please contact the hub administrators. -
-
- - Tap to try a different account - + + We are investigating an issue that causes login failures for some users. + As a temporary workaround, please login to mail.utoronto.ca first, and then you should be able to login to the JupyterHub.
{% else %} From 9c9a1ce935d37c9c288261111684a4ea0fc9d8ce Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Tue, 9 Jan 2024 12:57:10 -0800 Subject: [PATCH 2/7] Handle nbgitpuller links correctly --- extra-assets/js/login.js | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/extra-assets/js/login.js b/extra-assets/js/login.js index 96290f7..8dbdd16 100644 --- a/extra-assets/js/login.js +++ b/extra-assets/js/login.js @@ -1,32 +1,22 @@ -function redirectIfNeeded() { - // Only redirect utoronto.2i2c.cloud, lets us keep staging at staging.utoronto.2i2c.cloud - if (window.location.hostname === 'utoronto.2i2c.cloud') { - // Let's give users an indication that something is happening - document.write("Redirecting you to jupyter.utoronto.ca"); - window.location.hostname = 'jupyter.utoronto.ca'; - } -} -function setInterface(interfaceUrl) { - let loginUrl = new URL($('#home').data('authenticator-login-url'), document.location.origin); - loginUrl.searchParams.set('next', '/hub/user-redirect/' + interfaceUrl) - $('#login-button').attr( - 'href', - loginUrl.toString() - ); -} $(function() { - redirectIfNeeded(); + const curUrl = new URL(document.location); // if next query param is presentm just do nothing - const nextPresent = new URL(document.location).searchParams.get('next'); + const nextPresent = curUrl.searchParams.get('next'); // /hub/ being next should be treated same as no next present + // GET + // https://jupyter.utoronto.ca/hub/oauth_login?next=/hub/ if (!nextPresent || nextPresent === "/hub/") { - setInterface($("input[name='interface']:checked").val()); - - $("input[name='interface']").change(function() { - if (this.checked) { - setInterface(this.value) - } - }); + // The 'unified' home page for all the hubs is at https://datatools.utoronto.ca, + // so anyone landing on the home page should just be redirected. + document.write("Redirecting you to datatools.utoronto.ca"); + window.location.replace("https://datatools.utoronto.ca"); + } else { + // The user has landed on this page, which means they are not actually logged in, + // and need to login to continue to wherever they are going. So let's construct the + // appropriate oauth_login URL for them to go to. + let oauthLoginUrl = new URL(document.location); + oauthLoginUrl.pathname = "/oauth_login"; + window.location.replace(oauthLoginUrl); } }) \ No newline at end of file From a591e10be31968ffb79752de1a0bb2b83e3b4b31 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Tue, 9 Jan 2024 13:00:32 -0800 Subject: [PATCH 3/7] Add some debugging --- extra-assets/js/login.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/extra-assets/js/login.js b/extra-assets/js/login.js index 8dbdd16..1211ac7 100644 --- a/extra-assets/js/login.js +++ b/extra-assets/js/login.js @@ -1,11 +1,11 @@ $(function() { const curUrl = new URL(document.location); // if next query param is presentm just do nothing - const nextPresent = curUrl.searchParams.get('next'); + const nextUrl = curUrl.searchParams.get('next'); + console.log('next is'); + console.log(nextUrl); // /hub/ being next should be treated same as no next present - // GET - // https://jupyter.utoronto.ca/hub/oauth_login?next=/hub/ - if (!nextPresent || nextPresent === "/hub/") { + if (!nextUrl || nextUrl === "/hub/") { // The 'unified' home page for all the hubs is at https://datatools.utoronto.ca, // so anyone landing on the home page should just be redirected. document.write("Redirecting you to datatools.utoronto.ca"); @@ -16,6 +16,8 @@ $(function() { // appropriate oauth_login URL for them to go to. let oauthLoginUrl = new URL(document.location); oauthLoginUrl.pathname = "/oauth_login"; + console.log('loginurl is'); + console.log(oauthLoginUrl); window.location.replace(oauthLoginUrl); } From 321467b955bbf8a537af8b563d85d8b5a2fc760b Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Tue, 9 Jan 2024 13:05:52 -0800 Subject: [PATCH 4/7] Empty out the home page --- templates/login.html | 129 +------------------------------------------ 1 file changed, 1 insertion(+), 128 deletions(-) diff --git a/templates/login.html b/templates/login.html index 276a234..b26ee51 100644 --- a/templates/login.html +++ b/templates/login.html @@ -15,132 +15,5 @@ {% endblock %} {% block main %} -