From 09f6f64e5b7d115251c5fc6b42a697da1f127508 Mon Sep 17 00:00:00 2001 From: Anton Barkovsky Date: Tue, 4 Feb 2014 16:38:10 +0300 Subject: [PATCH] Make logout view do nothing if the user is already logged out --- flask_security/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flask_security/views.py b/flask_security/views.py index 981ea8a..36f4f7d 100644 --- a/flask_security/views.py +++ b/flask_security/views.py @@ -88,11 +88,11 @@ def login(): **_ctx('login')) -@login_required def logout(): """View function which handles a logout request.""" - logout_user() + if current_user.is_authenticated(): + logout_user() return redirect(request.args.get('next', None) or get_url(_security.post_logout_view))