From 7990f4518ba1c685393ffa663e676aaf3f3ddd11 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 29 May 2023 13:48:43 +0200 Subject: [PATCH] redirect in logout --- .../resources/device/templates/devices/layout.html | 2 +- ereuse_devicehub/views.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/resources/device/templates/devices/layout.html b/ereuse_devicehub/resources/device/templates/devices/layout.html index 713fdaf4..ed89a16a 100644 --- a/ereuse_devicehub/resources/device/templates/devices/layout.html +++ b/ereuse_devicehub/resources/device/templates/devices/layout.html @@ -53,7 +53,7 @@ {% else %} - Logout + Logout {% endif %} diff --git a/ereuse_devicehub/views.py b/ereuse_devicehub/views.py index 91676032..eaa2c4f1 100644 --- a/ereuse_devicehub/views.py +++ b/ereuse_devicehub/views.py @@ -66,8 +66,9 @@ class LogoutView(View): def dispatch_request(self): session_vars = ['token_dlt', 'rols'] [session.pop(i, '') for i in session_vars] + next_url = flask.request.args.get('next') logout_user() - return flask.redirect(flask.url_for('core.login')) + return flask.redirect(next_url or flask.url_for('core.login')) class GenericMixin(View):