diff --git a/backend/web/login/login.py b/backend/web/login/login.py index 25f09a006ace2a225fdf17d3f674a810a6a64fa4..99851d29d462201163971db83884eba015fb27b7 100644 --- a/backend/web/login/login.py +++ b/backend/web/login/login.py @@ -146,7 +146,10 @@ def login(): name = " " + identity['traits']['name'] else: name = "" - return render_template("loggedin.html", api_url=KRATOS_PUBLIC_URL, dashboard_url=DASHBOARD_URL, name=name) + return render_template("loggedin.html", + api_url=KRATOS_PUBLIC_URL, + dashboard_url=DASHBOARD_URL, + name=name) # If we do not have a flow, get one. if not flow: diff --git a/backend/web/static/base.js b/backend/web/static/base.js index e7cab4a0d962dec9018d14fe703cb784a1a612da..7838a87d38d20236108d2524b0a965601e0e654a 100644 --- a/backend/web/static/base.js +++ b/backend/web/static/base.js @@ -16,16 +16,25 @@ */ +// In default configuration the dashboed is on '/'. This can be overwritten +// before calling the scripts (and configured by the flask app +var dashboard_url = '/'; + // Check if an auth flow is configured and redirect to auth page in that // case. function check_flow_auth() { var state = Cookies.get('flow_state'); var url = Cookies.get('auth_url'); + // Redirect to the specified URL if (state == 'auth') { Cookies.set('flow_state', ''); window.location.href = url; + return; } + + // If no redirect is set, redirect to dashboard + window.location.href = dashboard_url + '/login'; } // Check if there if the flow is expired, if so, reset the cookie diff --git a/backend/web/templates/loggedin.html b/backend/web/templates/loggedin.html index aee728efd7af9818830128570bcc6a95f5ab4f1a..51b35cd13e744db651d78e077defa86b2309a26f 100644 --- a/backend/web/templates/loggedin.html +++ b/backend/web/templates/loggedin.html @@ -4,6 +4,7 @@ <script> var api_url = '{{ api_url }}'; + var dashboard_url = '{{ dashboard_url }}'; // Actions $(document).ready(function() { @@ -17,8 +18,7 @@ <div id="contentMessages"></div> <div id="contentWelcome"> - Welcome{{ name }}, you are logged in. + Welcome{{ name }}, you are logged in. We are redirecting you.... </div> - {% endblock %}