diff --git a/backend/server/demo/settings.py b/backend/server/demo/settings.py index a84b7b74..9170fe2f 100644 --- a/backend/server/demo/settings.py +++ b/backend/server/demo/settings.py @@ -209,6 +209,5 @@ from os import getenv -CSRF_TRUSTED_ORIGINS = getenv('CSRF_TRUSTED_ORIGINS', 'localhost').split(',') - +CSRF_TRUSTED_ORIGINS = [origin.strip() for origin in getenv('CSRF_TRUSTED_ORIGINS', 'http://localhost').split(',') if origin.strip()] DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' diff --git a/frontend/src/routes/profile/+page.server.ts b/frontend/src/routes/profile/+page.server.ts new file mode 100644 index 00000000..7c8c5ae6 --- /dev/null +++ b/frontend/src/routes/profile/+page.server.ts @@ -0,0 +1,11 @@ +import { redirect } from '@sveltejs/kit'; +import type { PageServerLoad, RequestEvent } from '../$types'; + +export const load: PageServerLoad = async (event: RequestEvent) => { + if (!event.locals.user) { + return redirect(302, '/login'); + } + return { + user: event.locals.user + }; +}; diff --git a/frontend/src/routes/profile/+page.svelte b/frontend/src/routes/profile/+page.svelte new file mode 100644 index 00000000..baa71a6f --- /dev/null +++ b/frontend/src/routes/profile/+page.svelte @@ -0,0 +1,37 @@ + + + + + + +{#if data.user.profile_pic} +
{data.user.username}
+ +{#if data.user && data.user.date_joined} +Member Since
+{new Date(data.user.date_joined).toLocaleDateString()}
+