From 1373a4d70a505e99671ed907cecf407c2c1d9f06 Mon Sep 17 00:00:00 2001 From: Mateo Morris Date: Fri, 25 Aug 2023 22:09:53 -0400 Subject: [PATCH 1/4] add favicon --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 032951a63..881e6f9e3 100644 --- a/public/index.html +++ b/public/index.html @@ -6,7 +6,7 @@ - + From 151d73d392494d26d7a169a05b9f2092fea8bea2 Mon Sep 17 00:00:00 2001 From: Mateo Morris Date: Fri, 25 Aug 2023 22:10:45 -0400 Subject: [PATCH 2/4] fix creating collaborator account --- src/routes/api/invitations/+server.js | 41 ++++++++++++-------- src/routes/auth/SignIn.svelte | 6 --- src/routes/auth/SignUp.svelte | 6 --- src/routes/auth/set-password/+page.server.js | 30 +++++++------- src/routes/auth/set-password/+page.svelte | 15 ++----- 5 files changed, 45 insertions(+), 53 deletions(-) diff --git a/src/routes/api/invitations/+server.js b/src/routes/api/invitations/+server.js index 06c16f5cc..1c6654880 100644 --- a/src/routes/api/invitations/+server.js +++ b/src/routes/api/invitations/+server.js @@ -1,30 +1,39 @@ -import { json } from '@sveltejs/kit'; +import { json } from '@sveltejs/kit' import supabase_admin from '$lib/supabase/admin' export async function POST({ request }) { - const {url, site = null, server_invitation, role, email} = await request.json(); + const { + url, + site = null, + server_invitation, + role, + email, + } = await request.json() - const { data, error } = await supabase_admin.auth.admin.inviteUserByEmail(email, { redirectTo: `${url}/auth/set-password?email=${email}` }) + const { data, error } = await supabase_admin.auth.admin.inviteUserByEmail( + email, + { redirectTo: `${url}/auth/set-password?email=${email}` } + ) if (!error) { + await supabase_admin.from('users').insert({ + id: data.user.id, + email: data.user.email, + }) - await supabase_admin - .from('users') - .insert({ - id: data.user.id, - email: data.user.email - }) - // Add to 'server_members' or 'collaborators' - const {error} = server_invitation ? - await supabase_admin.from('server_members').insert({ user: data.user.id, role }) : - await supabase_admin.from('collaborators').insert({ site, user: data.user.id, role }) + const { error } = server_invitation + ? await supabase_admin + .from('server_members') + .insert({ user: data.user.id, role }) + : await supabase_admin + .from('collaborators') + .insert({ site, user: data.user.id, role }) console.error(error) - return json({success: !error, error: error?.message}); + return json({ success: !error, error: error?.message }) } else { console.error(error) - return json({success: false, error: error.message}); + return json({ success: false, error: error.message }) } - } diff --git a/src/routes/auth/SignIn.svelte b/src/routes/auth/SignIn.svelte index 7c3c74b00..951949adf 100644 --- a/src/routes/auth/SignIn.svelte +++ b/src/routes/auth/SignIn.svelte @@ -17,12 +17,6 @@ Password -