Refactor user account system and remove moderation integration

- Remove first_name and last_name fields from User model
- Add user deletion and social provider services
- Restructure auth serializers into separate directory
- Update avatar upload functionality and API endpoints
- Remove django-moderation integration documentation
- Add mandatory compliance enforcement rules
- Update frontend documentation with API usage examples
This commit is contained in:
pacnpal
2025-08-30 07:31:58 -04:00
parent bb7da85516
commit 04394b9976
31 changed files with 7200 additions and 1297 deletions

View File

@@ -1,33 +1,3 @@
from django.db import models
from django.conf import settings
from django.utils import timezone
class PasswordReset(models.Model):
"""Persisted password reset tokens for API-driven password resets."""
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name="password_resets",
)
token = models.CharField(max_length=128, unique=True, db_index=True)
created_at = models.DateTimeField(auto_now_add=True)
expires_at = models.DateTimeField()
used = models.BooleanField(default=False)
class Meta:
ordering = ["-created_at"]
verbose_name = "Password Reset"
verbose_name_plural = "Password Resets"
def is_expired(self) -> bool:
return timezone.now() > self.expires_at
def mark_used(self) -> None:
self.used = True
self.save(update_fields=["used"])
def __str__(self):
user_id = getattr(self, "user_id", None)
return f"PasswordReset(user={user_id}, token={self.token[:8]}..., used={self.used})"
# This file is intentionally empty.
# All models are now in their appropriate apps to avoid conflicts.
# PasswordReset model is available in apps.accounts.models