diff --git a/pillar/api/utils/authentication.py b/pillar/api/utils/authentication.py index 3940b621..8f153eb2 100644 --- a/pillar/api/utils/authentication.py +++ b/pillar/api/utils/authentication.py @@ -189,7 +189,7 @@ def validate_this_token(token, oauth_subclient=None): return None g.current_user = UserClass.construct(token, db_user) - user_authenticated.send(None) + user_authenticated.send(sender=g.current_user) return db_user diff --git a/pillar/auth/__init__.py b/pillar/auth/__init__.py index 14ee63ff..9f13b690 100644 --- a/pillar/auth/__init__.py +++ b/pillar/auth/__init__.py @@ -12,7 +12,9 @@ from werkzeug.local import LocalProxy from pillar import current_app +# The sender is the user that was just authenticated. user_authenticated = blinker.Signal('Sent whenever a user was authenticated') + log = logging.getLogger(__name__) # Mapping from user role to capabilities obtained by users with that role. @@ -225,7 +227,7 @@ def login_user_object(user: UserClass): """Log in the given user.""" flask_login.login_user(user, remember=True) g.current_user = user - user_authenticated.send(None) + user_authenticated.send(sender=user) def logout_user():