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

'WebAuthnCredentialManager' object has no attribute 'devices_for_user' #22

Closed
nijel opened this issue Aug 27, 2024 · 1 comment · Fixed by #23
Closed

'WebAuthnCredentialManager' object has no attribute 'devices_for_user' #22

nijel opened this issue Aug 27, 2024 · 1 comment · Fixed by #23

Comments

@nijel
Copy link
Contributor

nijel commented Aug 27, 2024

django-otp relies on Device subclasses managers have devices_for_user method. Without that, some code paths will fail:

  File "/home/weblate/weblate-env/lib/python3.11/site-packages/django_otp/forms.py", line 317, in clean
    self.clean_otp(self.user)
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/weblate/weblate-env/lib/python3.11/site-packages/django_otp/forms.py", line 102, in clean_otp
    user.otp_device = self._verify_token(user, token, device)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/weblate/weblate-env/lib/python3.11/site-packages/django_otp/forms.py", line 176, in _verify_token
    device = match_token(user, token)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/weblate/weblate-env/lib/python3.11/site-packages/django_otp/__init__.py", line 97, in match_token
    for device in devices_for_user(user, for_verify=True):
    ^^^^^^^^^^^^^^^^^
  File "/home/weblate/weblate-env/lib/python3.11/site-packages/django_otp/__init__.py", line 130, in devices_for_user
    device_set = model.objects.devices_for_user(user, confirmed=confirmed)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nijel added a commit to nijel/weblate that referenced this issue Aug 30, 2024
We know the class we want to use, so there is no need to iterate over
other class (which might fail due to issues like
Stormbase/django-otp-webauthn#22).

Fixes WeblateOrg#12369
Fixes WEBLATE-DYJ
nijel added a commit to nijel/weblate that referenced this issue Aug 30, 2024
We know the class we want to use, so there is no need to iterate over
other class (which might fail due to issues like
Stormbase/django-otp-webauthn#22).

Fixes WeblateOrg#12369
Fixes WEBLATE-DYJ
nijel added a commit to WeblateOrg/weblate that referenced this issue Aug 30, 2024
We know the class we want to use, so there is no need to iterate over
other class (which might fail due to issues like
Stormbase/django-otp-webauthn#22).

Fixes #12369
Fixes WEBLATE-DYJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@nijel and others