diff --git a/backend/server/adventures/admin.py b/backend/server/adventures/admin.py index 1a8f7a8..1beac0f 100644 --- a/backend/server/adventures/admin.py +++ b/backend/server/adventures/admin.py @@ -59,9 +59,9 @@ from users.models import CustomUser class CustomUserAdmin(UserAdmin): model = CustomUser - list_display = ['username', 'email', 'is_staff', 'is_active', 'image_display'] + list_display = ['username', 'is_staff', 'is_active', 'image_display'] readonly_fields = ('uuid',) - search_fields = ('username', 'email') + search_fields = ('username',) fieldsets = UserAdmin.fieldsets + ( (None, {'fields': ('profile_pic', 'uuid', 'public_profile')}), ) diff --git a/frontend/src/routes/_allauth/[...path]/+server.ts b/frontend/src/routes/_allauth/[...path]/+server.ts index 9261320..92071cb 100644 --- a/frontend/src/routes/_allauth/[...path]/+server.ts +++ b/frontend/src/routes/_allauth/[...path]/+server.ts @@ -12,8 +12,8 @@ export async function GET(event) { /** @type {import('./$types').RequestHandler} */ export async function POST({ url, params, request, fetch, cookies }) { - const searchParam = url.search ? `${url.search}&format=json` : '?format=json'; - return handleRequest(url, params, request, fetch, cookies, searchParam, true); + const searchParam = url.search ? `${url.search}` : ''; + return handleRequest(url, params, request, fetch, cookies, searchParam, false); } export async function PATCH({ url, params, request, fetch, cookies }) { @@ -22,8 +22,8 @@ export async function PATCH({ url, params, request, fetch, cookies }) { } export async function PUT({ url, params, request, fetch, cookies }) { - const searchParam = url.search ? `${url.search}&format=json` : '?format=json'; - return handleRequest(url, params, request, fetch, cookies, searchParam, true); + const searchParam = url.search ? `${url.search}` : ''; + return handleRequest(url, params, request, fetch, cookies, searchParam, false); } export async function DELETE({ url, params, request, fetch, cookies }) { diff --git a/frontend/src/routes/settings/+page.svelte b/frontend/src/routes/settings/+page.svelte index 7b73e9b..6b55c8c 100644 --- a/frontend/src/routes/settings/+page.svelte +++ b/frontend/src/routes/settings/+page.svelte @@ -15,6 +15,8 @@ emails = data.props.emails; } + let new_email: string = ''; + onMount(async () => { if (browser) { const queryParams = new URLSearchParams($page.url.search); @@ -66,6 +68,38 @@ addToast('error', 'Error removing email'); } } + + async function verifyEmail(email: { email: any; verified?: boolean; primary?: boolean }) { + let res = await fetch('/_allauth/browser/v1/account/email/', { + method: 'PUT', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ email: email.email }) + }); + if (res.ok) { + addToast('success', 'Email sent to verify'); + } else { + addToast('error', 'Error verifying email. Try again in a few minutes.'); + } + } + + async function addEmail() { + let res = await fetch('/_allauth/browser/v1/account/email/', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ email: new_email }) + }); + if (res.ok) { + addToast('success', 'Email added'); + emails = [...emails, { email: new_email, verified: false, primary: false }]; + new_email = ''; + } else { + addToast('error', 'Error adding email'); + } + }
+
{email.email} - {email.verified ? '✅' : '❌'} - {email.primary ? '🔑' : ''} - + {#if email.verified} +
No emails
{/if}{$t('adventures.visited_region_check_desc')}
+{$t('adventures.update_visited_regions_disclaimer')}
+ -{$t('adventures.update_visited_regions_disclaimer')}