Skip to content

Commit

Permalink
sessions: renames KVSession interface class
Browse files Browse the repository at this point in the history
  • Loading branch information
Glignos committed May 8, 2020
1 parent 382f8b8 commit c79fd75
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion invenio_accounts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,5 @@
"""If True, add X-Session-ID and X-User-ID to the HTTP response."""

SESSION_INTERFACE_FACTORY = \
'invenio_accounts.sessions:KVSessionInterfaceWithAnonymousSessions'
'invenio_accounts.sessions:KVSessionInterfaceStoreAuthenticated'
"""Set the session interface factory for KVSession"""
4 changes: 2 additions & 2 deletions invenio_accounts/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ def default_session_store_factory(app):
return DictStore()


class KVSessionInterfaceWithAnonymousSessions(KVSessionInterface):
class KVSessionInterfaceStoreAuthenticated(KVSessionInterface):
"""Session interface to avoid storing anonymous sessions."""

def store_session(self, session):
"""Store session only when user is authenticated."""
if current_user.is_authenticated:
super(KVSessionInterfaceWithAnonymousSessions, self).store_session(
super(KVSessionInterfaceStoreAuthenticated, self).store_session(
session
)

0 comments on commit c79fd75

Please sign in to comment.