feat: approve users, edit users through manage users page (#1383)

This commit is contained in:
Markos Gogoulos
2025-09-20 15:16:52 +03:00
committed by GitHub
parent 8e8454d8c2
commit cbef629baf
30 changed files with 1384 additions and 790 deletions

10
cms/auth_backends.py Normal file
View File

@@ -0,0 +1,10 @@
from django.conf import settings
from django.contrib.auth.backends import ModelBackend
class ApprovalBackend(ModelBackend):
def user_can_authenticate(self, user):
can_authenticate = super().user_can_authenticate(user)
if can_authenticate and settings.USERS_NEEDS_TO_BE_APPROVED and not user.is_superuser:
return getattr(user, 'is_approved', False)
return can_authenticate