Skip to content

Commit

Permalink
Revert "Unconditionally redirect everyone to the common landing page"
Browse files Browse the repository at this point in the history
This reverts commit 20ea792.
  • Loading branch information
yuvipanda committed Jan 9, 2024
1 parent 20ea792 commit 154327a
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions extra-assets/js/login.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
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() {
// 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");
redirectIfNeeded();
// if next query param is presentm just do nothing
const nextPresent = new URL(document.location).searchParams.get('next');
// /hub/ being next should be treated same as no next present
if (!nextPresent || nextPresent === "/hub/") {
setInterface($("input[name='interface']:checked").val());

$("input[name='interface']").change(function() {
if (this.checked) {
setInterface(this.value)
}
});
}

})

0 comments on commit 154327a

Please sign in to comment.