* feat: add README for @cio/db package and remove existingAccounts.json * load session, load profile and organization, add create profile hook * chore: cache session request The trick was passing all the cookies to the backend. Previously I was only passing the better-auth.session_token and not better-auth.session_data. Read about the difference here https://www.better-auth.com/docs/concepts/cookies#custom-cookies * feat: login, logout, onboarding, verify email, reset password. * feat: complete change email and email verification * feat: standardise how we make rpc calls and create org endpoints * fix ui errors * fix: handle potential undefined customerId and standardize avatar URL property * refactor: standardize custom domain handling and update telegram chat ID references * chore: add tailwind prefix to @cio/ui this fixed the media query issues because @cio/ui classes were overriding this dashboard tailwind build * chore: clean up org sidebar * chore: persist mode state * feat: implement order breadcrumbs * chore: upgrade to better auth 1.4 * chore: address common auth flow bugs and setup app for others to setup locally.
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import * as z from 'zod';
|
|
|
|
import { defineEmail } from '../send';
|
|
import { getDefaultTemplate } from '../templates';
|
|
|
|
export const verifyEmailEmail = defineEmail({
|
|
id: 'verifyEmail',
|
|
subject: 'Action Required: Confirm your email',
|
|
schema: z.object({
|
|
link: z.url(),
|
|
newEmail: z.email().optional(),
|
|
userName: z.string().optional()
|
|
}),
|
|
render: (fields) => {
|
|
const isEmailChange = !!fields.newEmail;
|
|
const userName = fields.userName || 'there';
|
|
|
|
const content = isEmailChange
|
|
? `
|
|
<p><strong>Hey ${userName} 👋</strong></p>
|
|
<p>You have requested to change your email address to <strong>${fields.newEmail}</strong>.</p>
|
|
<p>To approve this change, please click the button below:</p>
|
|
<div>
|
|
<a class="button" href="${fields.link}">Approve Email Change</a>
|
|
</div>
|
|
<p>If you did not request this change, please ignore this email.</p>
|
|
`
|
|
: `
|
|
<p><strong>Hey ${userName} 👋</strong></p>
|
|
<p>Welcome to ClassroomIO! In order to get your account ready for usage, we need to verify your email. </p>
|
|
<p>We do this to make sure we don't get fake user emails in our signup. To get the best out of our product, we'll need you to verify your email by clicking the <strong>Verify</strong> button below
|
|
</p>
|
|
<div>
|
|
<a class="button" href="${fields.link}">Verify</a>
|
|
</div>
|
|
`;
|
|
|
|
return getDefaultTemplate(content);
|
|
}
|
|
});
|