Add JWT auth with per-user data isolation and account settings.

Users can register, log in, and manage profile/password in a personal account page; server data is scoped by owner across contacts, maps, tags, and import.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-28 21:10:16 +03:00
co-authored by Cursor
parent 85b8b2e9b8
commit 4eb4c145b6
40 changed files with 2301 additions and 117 deletions
+29
View File
@@ -0,0 +1,29 @@
DEFAULT_SECTORS = [
{'key': 'work', 'label': 'Работа'},
{'key': 'study', 'label': 'Учёба'},
{'key': 'hobby', 'label': 'Хобби'},
{'key': 'family', 'label': 'Семья'},
{'key': 'health', 'label': 'Здоровье'},
{'key': 'other', 'label': 'Другое'},
]
DEFAULT_CIRCLES = [
{'key': 'support', 'label': 'Круг поддержки'},
{'key': 'productivity', 'label': 'Круг продуктивности'},
{'key': 'development', 'label': 'Круг развития'},
]
def ensure_user_defaults(user):
"""Создаёт тип карты по умолчанию для нового пользователя."""
from contacts.models import NetworkMapType
if NetworkMapType.objects.filter(owner=user, is_default=True).exists():
return
NetworkMapType.objects.create(
owner=user,
is_default=True,
name='Стандартная',
sectors=DEFAULT_SECTORS,
circles=DEFAULT_CIRCLES,
)