mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Ensure that the session is logged out server side, not just client side.
Anytime a user clicks "sign out" we should be signing them out server side as well. This can be accomplished by setting the Users.current_session_id = null. I found that the method User.logged_in_elsewhere doesn't need to check if the current_session_id is None. The current_session_ids in the cookie and db (redis or postgres) then the user should be forced to log in again.
This commit is contained in:
@@ -60,8 +60,7 @@ def test_doesnt_redirect_to_sign_in_if_no_session_info(
|
||||
|
||||
|
||||
@pytest.mark.parametrize('db_sess_id, cookie_sess_id', [
|
||||
pytest.param(None, None, marks=pytest.mark.xfail), # OK - not used notify since browser signout was implemented
|
||||
|
||||
(None, None),
|
||||
(uuid.UUID(int=1), None), # BAD - has used other browsers before but this is a brand new browser with no cookie
|
||||
(uuid.UUID(int=1), uuid.UUID(int=2)), # BAD - this person has just signed in on a different browser
|
||||
])
|
||||
|
||||
@@ -4,9 +4,9 @@ from tests.conftest import SERVICE_ONE_ID
|
||||
|
||||
|
||||
def test_render_sign_out_redirects_to_sign_in(
|
||||
client
|
||||
logged_in_client
|
||||
):
|
||||
response = client.get(
|
||||
response = logged_in_client.get(
|
||||
url_for('main.sign_out'))
|
||||
assert response.status_code == 302
|
||||
assert response.location == url_for(
|
||||
|
||||
Reference in New Issue
Block a user