clear session on logout
guruofgentoo opened this issue · comments
Matt Lewellyn commented
Generally when logout happens, we'll want the session to be cleared as well. We should put a setting in to make this behavior configurable.
Signal:
@user_logged_out.connect_via(app)
def _after_logout_hook(sender, user, **extra):
session.clear()
Test:
def test_session_cleared_after_signing_out(self):
with flask.current_app.test_request_context():
flask.session['foo'] = 'bar'
assert 'foo' in list(flask.session)
logout_user()
assert len(list(flask.session)) == 0