mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 17:24:23 -04:00
- 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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user