Closed chromakey closed 5 years ago
This is probably happening because we add user.id
to the session (see https://github.com/percipient/django-allauth-2fa/blob/6d666d634ded380c4a7f660ac5a729fae095ffb2/allauth_2fa/adapter.py#L22-L24), which I guess is of type UUID
? (I've never used a UUIDField
, is the value a UUID
object, not a string?)
It might work to cast to a string when adding it to the session, like: request.session['allauth_2fa_user_id'] = str(user.id)
That indeed worked. Thanks! I'll submit a PR today with the change.
Awesome! 💥 Please include tests with your PR! I'll try to review it within the next few days.
I'm not sure how I'd write a good test in the current context. Since the current user model defaults to using IntegerField as the ID/PK, I supposed I'd have to write a dummy user model?
I'll think a bit about how to test this.
I'll think a bit about how to test this.
@clokep Hi Patrick. Thank you for this response. I have run into a similar issue but this is when I try to login. The registration part works fine, but logging in isn't quite working. My login parameters are email and password
What could I be getting wrong?
Howdy, I have an existing project that's been using django-allauth successfully for several months now. I've setup django-allauth-2fa and I was able to successfully register a device. However, when I go to login, I get the following exception and traceback. I am using a UUIDField for my User model primary key. I am requiring that all users have 2FA enabled.
Thanks for all of your work on this project!