You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT: I see the code in the repository has been updated, it's just not updated in the package on pypi (0.62.1)
If I try to disconnect a social account when there are multiple accounts connected, I get a 500 error with the following traceback:
[13/May/2024 00:29:48] ERROR [django.request:241] Internal Server Error: /en/accounts/3rdparty/
Traceback (most recent call last):
File ".venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File ".venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File ".venv/lib/python3.10/site-packages/sentry_sdk/integrations/django/views.py", line 84, in sentry_wrapped_callback
return callback(request, *args, **kwargs)
File ".venv/lib/python3.10/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
File ".venv/lib/python3.10/site-packages/django/utils/decorators.py", line 48, in _wrapper
return bound_method(*args, **kwargs)
File ".venv/lib/python3.10/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapper_view
return view_func(request, *args, **kwargs)
File ".venv/lib/python3.10/site-packages/django/views/generic/base.py", line 143, in dispatch
return handler(request, *args, **kwargs)
File ".venv/lib/python3.10/site-packages/allauth/account/mixins.py", line 68, in post
ifform.is_valid():
File ".venv/lib/python3.10/site-packages/django/forms/forms.py", line 197, in is_valid
return self.is_bound and not self.errors
File ".venv/lib/python3.10/site-packages/django/forms/forms.py", line 192, in errors
self.full_clean()
File ".venv/lib/python3.10/site-packages/django/forms/forms.py", line 328, in full_clean
self._clean_form()
File ".venv/lib/python3.10/site-packages/django/forms/forms.py", line 349, in _clean_form
cleaned_data = self.clean()
File ".venv/lib/python3.10/site-packages/allauth/socialaccount/forms.py", line 57, in clean
flows.connect.validate_disconnect(self.request, account)
File ".venv/lib/python3.10/site-packages/allauth/socialaccount/internal/flows/connect.py", line 40, in validate_disconnect
adapter.validate_disconnect(account, accounts)
UnboundLocalError: local variable 'adapter' referenced before assignment
The validate_disconnect method in allauth/socialaccount/internal/flows/connect.py doesn't initialise the adapter variable if the is_last condition isn't met so the call to adapter.validate_disconnect(account, accounts) fails:
defvalidate_disconnect(request, account):
""" Validate whether or not the socialaccount account can be safely disconnected. """accounts=SocialAccount.objects.filter(user_id=account.user_id)
is_last=notaccounts.exclude(pk=account.pk).exists()
ifis_last:
adapter=get_adapter()
ifallauth_settings.SOCIALACCOUNT_ONLY:
raiseadapter.validation_error("disconnect_last")
# No usable password would render the local account unusableifnotaccount.user.has_usable_password():
raiseadapter.validation_error("no_password")
# No email address, no password resetif (
account_settings.EMAIL_VERIFICATION==account_settings.EmailVerificationMethod.MANDATORY
):
ifnotEmailAddress.objects.filter(
user=account.user, verified=True
).exists():
raiseadapter.validation_error("no_verified_email")
adapter.validate_disconnect(account, accounts)
Using django-allauth 0.62.1
The text was updated successfully, but these errors were encountered:
EDIT: I see the code in the repository has been updated, it's just not updated in the package on pypi (0.62.1)
If I try to disconnect a social account when there are multiple accounts connected, I get a 500 error with the following traceback:
The
validate_disconnect
method inallauth/socialaccount/internal/flows/connect.py
doesn't initialise theadapter
variable if theis_last
condition isn't met so the call toadapter.validate_disconnect(account, accounts)
fails:Using django-allauth 0.62.1
The text was updated successfully, but these errors were encountered: