redirect in logout

This commit is contained in:
Cayo Puigdefabregas 2023-05-29 13:48:43 +02:00
parent 46860660e0
commit 7990f4518b
2 changed files with 3 additions and 2 deletions

View file

@ -53,7 +53,7 @@
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#validateModal">Validate</button>
{% else %}
<button class="btn btn-primary" id="buttonRol" data-bs-toggle="modal" data-bs-target="#rolsModal">Select your rol</button>
<a class="btn btn-primary" href="{{ url_for('core.logout') }}">Logout</a>
<a class="btn btn-primary" href="{{ url_for('core.logout') }}?next={{ device_real.url.to_text() }}">Logout</a>
{% endif %}
</li>
</ul>

View file

@ -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):