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
No related merge requests found
......@@ -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:
......
......@@ -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
......
......@@ -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 %}
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