utils.py 476 B

1234567891011121314
  1. from django.conf import settings
  2. from organizations_ext.models import Organization
  3. def is_user_registration_open() -> bool:
  4. enable_user_registration = settings.ENABLE_OPEN_USER_REGISTRATION
  5. if not enable_user_registration:
  6. enable_user_registration = not Organization.objects.exists()
  7. return enable_user_registration
  8. def noop_token_creator(token_model, user, serializer):
  9. """ Fake token creator to use sessions instead of tokens """
  10. return None