Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Add default user for local dev

Tomas Valentadbe74c2abc67
diff --git a/README.md b/README.md
index 226e81813..b37dfe384 100644
--- a/README.md
+++ b/README.md
@@ -68,5 +68,5 @@ Then open the page on `http://localhost:3000`.
### 5. Sign in
Use the testing account with following credentials to sign in:
-Password: `[email protected]`
+Password: `[email protected]`
diff --git a/pages/index.tsx b/pages/index.tsx
index 3533070a0..8c0b278ad 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -24,7 +24,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {
}
}
- const user = await prisma.auth_users.findUniqueOrThrow({
+ const user = await prisma.auth_users.findUnique({
where: {
id: session.user.id,
},
@@ -41,6 +41,16 @@ export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {
},
})
+ if (!user) {
+ return {
+ redirect: {
+ destination: '/sign',
+ permanent: false,
+ }
+ }
+ }
+
+
const hasDefaultTeam = user?.users_teams.some(t => t.teams.is_default)
if (!hasDefaultTeam) {
// User is one of the old users without default team - create default team.
diff --git a/supabase/seed.sql b/supabase/seed.sql
index eb3187bfe..138feea6f 100644
--- a/supabase/seed.sql
+++ b/supabase/seed.sql
@@ -941,4 +941,18 @@ ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TAB
-- PostgreSQL database dump complete
--
+
+--
+-- Add default user and project data
+--
+
+INSERT INTO auth.users (instance_id, id, aud, role, email, encrypted_password, email_confirmed_at, invited_at, confirmation_token, confirmation_sent_at, recovery_token, recovery_sent_at, email_change_token_new, email_change, email_change_sent_at, last_sign_in_at, raw_app_meta_data, raw_user_meta_data, is_super_admin, created_at, updated_at, phone, phone_confirmed_at, phone_change, phone_change_token, phone_change_sent_at, email_change_token_current, email_change_confirm_status, banned_until, reauthentication_token, reauthentication_sent_at)
+VALUES
+ ('00000000-0000-0000-0000-000000000000', '5899f99d-a449-4bfa-8769-19c097aaf1f5', 'authenticated', 'authenticated', '[email protected]', '$2a$10$yLZXHGHl7mgJ.Ax3cBhQ6uJ77CBuqTkt3EnF2hj26KAgMuBPUWekS', '2022-10-04 03:41:27.39308+00', NULL, '', NULL, '', NULL, '', '', NULL, NULL, '{"provider": "email", "providers": ["email"]}', '{}', NULL, '2022-10-04 03:41:27.391146+00', '2022-10-04 03:41:27.39308+00', NULL, NULL, '', '', NULL, '', 0, NULL, '', NULL);
+
+INSERT INTO auth.identities (id,user_id,identity_data,provider,last_sign_in_at,created_at,updated_at)
+VALUES
+ ('5899f99d-a449-4bfa-8769-19c097aaf1f5', '5899f99d-a449-4bfa-8769-19c097aaf1f5'::uuid, '{"sub": "5899f99d-a449-4bfa-8769-19c097aaf1f5"}', 'email', '2022-10-04 04:45:00.000+00', '2022-10-04 03:41:27.391146+00', '2022-10-04 03:41:27.39308+00');
+
+
RESET ALL;