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:
@@ -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,
|
||||
)
|
||||
Reference in New Issue
Block a user