feature(auth): replace clerk.com with custom auth (#103)

* feature(auth): replace clerk.com with custom auth

* minor fixes

* remove notification preferences

* decrease live events interval

fix(api): cookies..

# Conflicts:
#	.gitignore
#	apps/api/src/index.ts
#	apps/dashboard/src/app/providers.tsx
#	packages/trpc/src/trpc.ts
This commit is contained in:
Carl-Gerhard Lindesvärd
2024-12-18 21:30:39 +01:00
committed by Carl-Gerhard Lindesvärd
parent f28802b1c2
commit d31d9924a5
151 changed files with 18484 additions and 12853 deletions

View File

@@ -11,7 +11,7 @@
},
"devDependencies": {
"@openpanel/tsconfig": "workspace:*",
"@types/node": "^18.16.0",
"@types/node": "20.14.8",
"prisma": "^5.1.1",
"typescript": "^5.2.2"
}

View File

@@ -300,3 +300,43 @@ export const zProject = z.object({
crossDomain: z.boolean().default(false),
});
export type IProjectEdit = z.infer<typeof zProject>;
export const zPassword = z
.string()
.min(8)
.regex(
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/,
'Password must contain at least 8 characters, one uppercase letter, one lowercase letter, one number and one special character',
);
export const zSignInEmail = z.object({
email: z.string().email().min(1),
password: zPassword,
});
export type ISignInEmail = z.infer<typeof zSignInEmail>;
export const zSignUpEmail = z
.object({
firstName: z.string().min(1),
lastName: z.string().min(1),
email: z.string().email(),
password: zPassword,
confirmPassword: zPassword,
inviteId: z.string().nullish(),
})
.refine((data) => data.password === data.confirmPassword, {
path: ['confirmPassword'],
message: 'Passwords do not match',
});
export type ISignUpEmail = z.infer<typeof zSignUpEmail>;
export const zResetPassword = z.object({
token: z.string(),
password: z.string().min(8),
});
export type IResetPassword = z.infer<typeof zResetPassword>;
export const zRequestResetPassword = z.object({
email: z.string().email(),
});
export type IRequestResetPassword = z.infer<typeof zRequestResetPassword>;

View File

@@ -84,3 +84,16 @@ export type FinalChart = {
series: IChartSerie[];
metrics: Metrics;
};
export type ISetCookie = (
key: string,
value: string,
options: {
maxAge?: number;
domain?: string;
path?: string;
sameSite?: 'lax' | 'strict' | 'none';
secure?: boolean;
httpOnly?: boolean;
},
) => void;