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
This library for some reason decides that if a user isn't active it just won't ever send an email out and it does this by monkey patching the user model to expose a new function
I don't know if this is the best or most elegant fix, but you can monkey patch it back out. A env setting to allow inactive users to have password resets would be so much better.
# django_rest_passwordreset_override.py
# Override for django-rest-passwordreset
from django.conf import settings
from django.contrib.auth import get_user_model
def override_password_reset():
# add eligible_for_reset to the user class
UserModel = get_user_model()
UserModel.add_to_class("eligible_for_reset", eligible_for_reset)
def eligible_for_reset(self):
if getattr(settings, 'DJANGO_REST_MULTITOKENAUTH_REQUIRE_USABLE_PASSWORD', True):
# if we require a usable password then return the result of has_usable_password()
return self.has_usable_password()
else:
# otherwise return True because we dont care about the result of has_usable_password()
return True
# urls.py
# call this after importing the rest urls
override_password_reset()
Does anyone know how to extend the APIVIew to return more accurate messages for is_active=False users?
The text was updated successfully, but these errors were encountered: