diff --git a/README.md b/README.md index 76a8a5f0..d12f2e77 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Paste the contents of the seed.sql file and hit 'Run'. Users can be added to the app through various methods: 1. **Supabase Panel**: Go to `localhost:8080` to create a user directly in the Supabase dashboard - authentication tab. -2. **Directly from a Browser**: Go to `localhost:8080/cpf/auth` to create a user via a authentication flow. +2. **Directly from a Browser**: Go to `localhost:8080/cpf/auth` to create a user via a authentication flow. Going forward we will probably get rid of this feature and focus on single sign on. 3. **Add Employee flow**: Employees can be added through the dashboard at `localhost:8080/cpf/people/add-new`. The default password is `password`. ### Automated Backend Processes diff --git a/frontend/src/actions/user.ts b/frontend/src/actions/user.ts index 5d384f47..cb00cde3 100644 --- a/frontend/src/actions/user.ts +++ b/frontend/src/actions/user.ts @@ -33,7 +33,12 @@ export async function login(formData: FormData) { } export async function signup(formData: FormData) { - const supabase = createClient(); + const supabase = createSupabaseClient(process.env.NEXT_PUBLIC_SUPABASE_SERVER_URL!, process.env.SERVICE_ROLE_KEY!, { + auth: { + autoRefreshToken: false, + persistSession: false, + }, + }); // type-casting here for convenience // in practice, you should validate your inputs @@ -42,12 +47,20 @@ export async function signup(formData: FormData) { password: formData.get('password') as string, }; - const { error } = await supabase.auth.signUp(data); - + const { error } = await supabase.auth.admin.createUser({ + email: data['email'], + email_confirm: true, + password: data['password'], + user_metadata: { + first_name: 'First Name', + last_name: 'Last Name' + }, + }); if (error) { redirect('/error'); } + revalidatePath('/'); redirect('/'); } diff --git a/seed.sql b/seed.sql index 0d20ff5a..60d0fbf9 100644 --- a/seed.sql +++ b/seed.sql @@ -319,10 +319,7 @@ INSERT INTO band_bucket (band_id, bucket_slug) VALUES ((SELECT band_id FROM band WHERE ladder_slug = 'frontend' AND threshold = 23), 'cross_platform_frontend'), ((SELECT band_id FROM band WHERE ladder_slug = 'frontend' AND threshold = 35), 'security'), ((SELECT band_id FROM band WHERE ladder_slug = 'frontend' AND threshold = 35), 'algorithmic_knowledge'), -((SELECT band_id FROM band WHERE ladder_slug = 'frontend' AND threshold = 35), 'releases_ci_cd'), -((SELECT band_id FROM band WHERE ladder_slug = 'frontend' AND threshold = 50), 'releases_ci_cd2'), -((SELECT band_id FROM band WHERE ladder_slug = 'frontend' AND threshold = 55), 'releases_ci_cd3'), -((SELECT band_id FROM band WHERE ladder_slug = 'frontend' AND threshold = 60), 'releases_ci_cd4'); +((SELECT band_id FROM band WHERE ladder_slug = 'frontend' AND threshold = 35), 'releases_ci_cd'); -- Insert advancement_level INSERT INTO advancement_level (bucket_slug, advancement_level, description) VALUES