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:
committed by
Carl-Gerhard Lindesvärd
parent
f28802b1c2
commit
d31d9924a5
45
packages/email/src/emails/email-invite.tsx
Normal file
45
packages/email/src/emails/email-invite.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import React from 'react';
|
||||
import { Button, Link, Text } from '@react-email/components';
|
||||
import { z } from 'zod';
|
||||
import { Layout } from '../components/layout';
|
||||
|
||||
export const zEmailInvite = z.object({
|
||||
url: z.string(),
|
||||
organizationName: z.string(),
|
||||
});
|
||||
|
||||
export type Props = z.infer<typeof zEmailInvite>;
|
||||
export default EmailInvite;
|
||||
export function EmailInvite({
|
||||
organizationName = 'Acme Co',
|
||||
url = 'https://openpanel.dev',
|
||||
}: Props) {
|
||||
return (
|
||||
<Layout>
|
||||
<Text>You've been invited to join {organizationName}!</Text>
|
||||
<Text>
|
||||
If you don't have an account yet, click the button below to create one
|
||||
and join the organization:
|
||||
</Text>
|
||||
<Button
|
||||
href={url}
|
||||
style={{
|
||||
backgroundColor: '#000',
|
||||
borderRadius: '6px',
|
||||
color: '#fff',
|
||||
padding: '12px 20px',
|
||||
textDecoration: 'none',
|
||||
}}
|
||||
>
|
||||
Join {organizationName}
|
||||
</Button>
|
||||
<Text>
|
||||
Join link: <Link href={url}>{url}</Link>
|
||||
</Text>
|
||||
<Text style={{ color: '#666' }}>
|
||||
Already have an account? No need to do anything - you'll have access
|
||||
automatically when you sign in.
|
||||
</Text>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
40
packages/email/src/emails/email-reset-password.tsx
Normal file
40
packages/email/src/emails/email-reset-password.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import React from 'react';
|
||||
import { Button, Link, Text } from '@react-email/components';
|
||||
import { z } from 'zod';
|
||||
import { Layout } from '../components/layout';
|
||||
|
||||
export const zEmailResetPassword = z.object({
|
||||
url: z.string(),
|
||||
});
|
||||
|
||||
export type Props = z.infer<typeof zEmailResetPassword>;
|
||||
export default EmailResetPassword;
|
||||
export function EmailResetPassword({ url = 'https://openpanel.dev' }: Props) {
|
||||
return (
|
||||
<Layout>
|
||||
<Text>
|
||||
You have requested to reset your password. Follow the link below to
|
||||
reset your password:
|
||||
</Text>
|
||||
<Button
|
||||
href={url}
|
||||
style={{
|
||||
backgroundColor: '#000',
|
||||
borderRadius: '6px',
|
||||
color: '#fff',
|
||||
padding: '12px 20px',
|
||||
textDecoration: 'none',
|
||||
}}
|
||||
>
|
||||
Reset password
|
||||
</Button>
|
||||
<Text>
|
||||
Reset password link: <Link href={url}>{url}</Link>
|
||||
</Text>
|
||||
<Text style={{ color: '#666' }}>
|
||||
Have you not requested this? Please ignore this email and contact
|
||||
support if you believe this was a mistake.
|
||||
</Text>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
23
packages/email/src/emails/index.tsx
Normal file
23
packages/email/src/emails/index.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { z } from 'zod';
|
||||
import { EmailInvite, zEmailInvite } from './email-invite';
|
||||
import EmailResetPassword, {
|
||||
zEmailResetPassword,
|
||||
} from './email-reset-password';
|
||||
|
||||
export const templates = {
|
||||
invite: {
|
||||
subject: (data: z.infer<typeof zEmailInvite>) =>
|
||||
`Invite to join ${data.organizationName}`,
|
||||
Component: EmailInvite,
|
||||
schema: zEmailInvite,
|
||||
},
|
||||
'reset-password': {
|
||||
subject: (data: z.infer<typeof zEmailResetPassword>) =>
|
||||
'Reset your password',
|
||||
Component: EmailResetPassword,
|
||||
schema: zEmailResetPassword,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export type Templates = typeof templates;
|
||||
export type TemplateKey = keyof Templates;
|
||||
Reference in New Issue
Block a user