Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DJANGO_SECRET_KEY=
DJANGO_ALLOWED_HOSTS=localhost,0.0.0.0,127.0.0.1

# Public base URL of the web frontend (used for links in emails, redirects, etc.)
FRONTEND_URL=http://localhost:5173
FRONTEND_URL=http://localhost:3000

# =============================================================================
# Database (PostgreSQL)
Expand All @@ -25,10 +25,11 @@ DATABASE_URL=postgres://user:password@localhost:5432/dbname
REDIS_URL=redis://localhost:6379/0

# =============================================================================
# CORS
# CORS / CSRF
# =============================================================================
# Comma-separated for multiple origins (e.g. http://localhost:5173,http://localhost:3000)
CORS_ALLOWED_ORIGINS=http://localhost:5173
CORS_ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000
CSRF_TRUSTED_ORIGINS=http://localhost:5173,http://localhost:3000

# =============================================================================
# Email (SMTP)
Expand Down
3 changes: 3 additions & 0 deletions apps/users/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def restore_user(self, user_id: int) -> None:

@transaction.atomic
def create_user(self, payload: UserCreateIn) -> User:
if User.objects.all_with_deleted().filter(email__iexact=payload.email).exists(): # pyright: ignore[reportAttributeAccessIssue]
raise HttpError(409, "User with this email already exists.")

user = User.objects.create_user(
username=payload.email,
email=payload.email,
Expand Down
2 changes: 2 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
CORS_ALLOWED_ORIGINS = env.list("CORS_ALLOWED_ORIGINS")
CORS_ALLOW_CREDENTIALS = True

CSRF_TRUSTED_ORIGINS = env.list("CSRF_TRUSTED_ORIGINS")

HEADLESS_ONLY = True
HEADLESS_SERVE_SPECIFICATION = True

Expand Down