Skip to content
Snippets Groups Projects
Commit 081081db authored by Mart van Santen's avatar Mart van Santen
Browse files

Redirect to dashboard as default if no redirect is set

parent b7e6e759
No related branches found
No related tags found
1 merge request!99Redirect to dashboard if not redirect login is set, on succesful login
Pipeline #38382 passed with stages
in 6 minutes and 36 seconds
...@@ -146,7 +146,10 @@ def login(): ...@@ -146,7 +146,10 @@ def login():
name = " " + identity['traits']['name'] name = " " + identity['traits']['name']
else: else:
name = "" 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 we do not have a flow, get one.
if not flow: if not flow:
......
...@@ -16,16 +16,25 @@ ...@@ -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 // Check if an auth flow is configured and redirect to auth page in that
// case. // case.
function check_flow_auth() { function check_flow_auth() {
var state = Cookies.get('flow_state'); var state = Cookies.get('flow_state');
var url = Cookies.get('auth_url'); var url = Cookies.get('auth_url');
// Redirect to the specified URL
if (state == 'auth') { if (state == 'auth') {
Cookies.set('flow_state', ''); Cookies.set('flow_state', '');
window.location.href = url; 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 // Check if there if the flow is expired, if so, reset the cookie
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<script> <script>
var api_url = '{{ api_url }}'; var api_url = '{{ api_url }}';
var dashboard_url = '{{ dashboard_url }}';
// Actions // Actions
$(document).ready(function() { $(document).ready(function() {
...@@ -17,8 +18,7 @@ ...@@ -17,8 +18,7 @@
<div id="contentMessages"></div> <div id="contentMessages"></div>
<div id="contentWelcome"> <div id="contentWelcome">
Welcome{{ name }}, you are logged in. Welcome{{ name }}, you are logged in. We are redirecting you....
</div> </div>
{% endblock %} {% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment