- Add unit test for when case when the cookie doesn't match the db.

- Move code into User.signout method to further encapsulate the code.
This commit is contained in:
Rebecca Law
2020-02-03 15:08:55 +00:00
parent 937c9f2adc
commit 0e1ee504ac
3 changed files with 6 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
from flask import abort, current_app, request, session
from flask_login import AnonymousUserMixin, UserMixin, login_user
from flask_login import AnonymousUserMixin, UserMixin, login_user, logout_user
from notifications_python_client.errors import HTTPError
from notifications_utils.timezones import utc_string_to_aware_gmt_datetime
from werkzeug.utils import cached_property
@@ -155,6 +155,8 @@ class User(JSONModel, UserMixin):
def sign_out(self):
# Update the db so the server also knows the user is logged out.
session.clear()
logout_user()
return self.update(current_session_id=None)
@property