diff --git a/static/js/login.js b/static/js/login.js index 37be2f0a16e5ea5777f112dac8b711b322370bb2..5e0e4308d3e325ac2b6d53a9a0a2d8a38aa1e469 100644 --- a/static/js/login.js +++ b/static/js/login.js @@ -34,12 +34,19 @@ function carouselNormalization() { }); } +function toggleWorkshopLogin(){ + const urlParams = new URLSearchParams(window.location.search); + const nextParam = urlParams.get('next'); + + if (nextParam && nextParam.startsWith('/hub/workshop')) { + $('#btn-login').hide(); + } else { + $('#btn-login').show(); + } + +} + $(document).ready(function () { carouselNormalization(); - - // Start cycling of carousel - // var carousel = new bootstrap.Carousel($('#login-carousel'), { - // interval: 5000, - // }) - // carousel.cycle(); + toggleWorkshopLogin(); }); \ No newline at end of file diff --git a/templates/login.html b/templates/login.html index 780f7efb0c3e86ebe5c914341aa9e2e24c1ff0dc..0fbf3c2c883c9ad8d171f459d16680797450f2de 100644 --- a/templates/login.html +++ b/templates/login.html @@ -33,6 +33,12 @@ </li> {%- endmacro -%} +{%- if custom_config.get("workshop", {}).get("login", {}).get("enabled", True) %} +{%- set login_text = "Regular sign in" -%} +{%- else %} +{%- set login_text = "Sign in" -%} +{%- endif -%} + {%- block main -%} <div class="row g-0 h-100 justify-content-center"> <div id="login-background" class="col-12 flex-column d-flex justify-content-center align-items-center h-100"> @@ -43,15 +49,6 @@ <div class="row g-0 w-100 d-flex justify-content-center align-items-center"> <p class="fs-5 text-dark ps-3"> Sign in using one of the following accounts - <!-- - For more information click - <a href="https://docs.{{hostname}}/github/FZJ-JSC/jupyter-jsc-notebooks/blob/documentation/01-Introduction/03-Login-to-Jupyter-JSC.ipynb" target="_blank"> - here. - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-question-circle-fill" viewBox="0 0 16 16"> - <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.496 6.033h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286a.237.237 0 0 0 .241.247zm2.325 6.443c.61 0 1.029-.394 1.029-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94 0 .533.425.927 1.01.927z"/> - </svg> - </a> - --> <!-- Logos --> <ul class="list-group list-group-flush my-2"> {{list_item("jsc-login", "images/pages/login/Logo_FZ_Juelich_jsc.png", alt="JSC-Account")}} @@ -69,10 +66,18 @@ <div class="d-flex justify-content-center align-items-center pt-5"> <a id="btn-login" class="btn btn-primary shadow btn-lg p-4" role="button"> <!-- <img src='{{static_url("images/pages/login/User.svg", include_version=False) }}'/> --> - Sign In + {{login_text}} </a> </div> - <p class="fs-6 fw-light text-dark align-self-end text-center">No account yet? + {%- if custom_config.get("workshop", {}).get("login", {}).get("enabled", True) %} + <div class="d-flex justify-content-center align-items-center pt-2"> + <a id="btn-login-workshop" class="btn btn-primary shadow btn-lg p-4" role="button"> + <!-- <img src='{{static_url("images/pages/login/User.svg", include_version=False) }}'/> --> + Workshop sign in + </a> + </div> + {%- endif -%} + <p class="fs-6 fw-light text-dark align-self-end text-center pt-2">No account yet? <a href="https://docs.{{hostname}}/github/FZJ-JSC/jupyter-jsc-notebooks/blob/documentation/01-Introduction/03-Login-to-Jupyter-JSC.ipynb" target="_blank"> Help <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-question-circle-fill" viewBox="0 0 16 16"> @@ -99,5 +104,10 @@ $("#btn-login").click(function () { var url = window.location.search; window.location.href = "{{ base_url }}oauth_login" + url; }); + +$("#btn-login-workshop").click(function () { + var url = window.location.search; + window.location.href = "{{ base_url }}oauth_login" + url; +}); </script> {%- endblock -%}