Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user_logged_in signal from Django is executed twice #191

Open
SebCorbin opened this issue Sep 28, 2023 · 0 comments
Open

user_logged_in signal from Django is executed twice #191

SebCorbin opened this issue Sep 28, 2023 · 0 comments

Comments

@SebCorbin
Copy link

This affects apps that are not allauth-aware, for example django-axes that logs access twice

See pennersr/django-allauth#3456

First execution

lib/python3.10/site-packages/allauth/account/views.py(111)post()
-> response = self.form_valid(form)
lib/python3.10/site-packages/allauth/account/views.py(169)form_valid()
-> return form.login(self.request, redirect_url=success_url)
lib/python3.10/site-packages/allauth/account/forms.py(196)login()
-> ret = perform_login(
lib/python3.10/site-packages/allauth/account/utils.py(168)perform_login()
-> return _perform_login(request, login)
lib/python3.10/site-packages/allauth/account/utils.py(178)_perform_login()
-> response = adapter.pre_login(request, login.user, **hook_kwargs)
lib/python3.10/site-packages/allauth_2fa/adapter.py(39)pre_login()
-> return super().login(request, user)
lib/python3.10/site-packages/allauth/account/adapter.py(471)login()
-> django_login(request, user)
lib/python3.10/site-packages/django/contrib/auth/__init__.py(144)login()
-> user_logged_in.send(sender=user.__class__, request=request, user=user)
lib/python3.10/site-packages/django/dispatch/dispatcher.py(176)send()
-> return [
lib/python3.10/site-packages/django/dispatch/dispatcher.py(177)<listcomp>()
-> (receiver, receiver(signal=self, sender=sender, **named))
lib/python3.10/site-packages/axes/signals.py(34)handle_user_logged_in()
-> AxesProxyHandler.user_logged_in(*args, **kwargs)
(Pdb++) c
lib/python3.10/site-packages/axes/signals.py(34)handle_user_logged_in()
-> AxesProxyHandler.user_logged_in(*args, **kwargs)

Second execution

lib/python3.10/site-packages/allauth/account/views.py(111)post()
-> response = self.form_valid(form)
lib/python3.10/site-packages/allauth/account/views.py(169)form_valid()
-> return form.login(self.request, redirect_url=success_url)
lib/python3.10/site-packages/allauth/account/forms.py(196)login()
-> ret = perform_login(
lib/python3.10/site-packages/allauth/account/utils.py(168)perform_login()
-> return _perform_login(request, login)
lib/python3.10/site-packages/allauth/account/utils.py(181)_perform_login()
-> return resume_login(request, login)
lib/python3.10/site-packages/allauth/account/utils.py(207)resume_login()
-> adapter.login(request, login.user)
lib/python3.10/site-packages/allauth/account/adapter.py(471)login()
-> django_login(request, user)
lib/python3.10/site-packages/django/contrib/auth/__init__.py(144)login()
-> user_logged_in.send(sender=user.__class__, request=request, user=user)
lib/python3.10/site-packages/django/dispatch/dispatcher.py(176)send()
-> return [
lib/python3.10/site-packages/django/dispatch/dispatcher.py(177)<listcomp>()
-> (receiver, receiver(signal=self, sender=sender, **named))
lib/python3.10/site-packages/axes/signals.py(34)handle_user_logged_in()
-> AxesProxyHandler.user_logged_in(*args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant