mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 17:21:41 +10:00
chore: refactor
This commit is contained in:
@ -37,7 +37,6 @@ export const sendConfirmationToken = async ({ email }: { email: string }) => {
|
||||
throw new Error(`Failed to create the verification token`);
|
||||
}
|
||||
|
||||
// TODO: Revisit tomorrow
|
||||
try {
|
||||
await sendConfirmationEmail({ userId: user.id });
|
||||
|
||||
|
||||
@ -135,11 +135,15 @@ export const profileRouter = router({
|
||||
.input(ZConfirmEmailMutationSchema)
|
||||
.mutation(async ({ input }) => {
|
||||
try {
|
||||
const { email } = input;
|
||||
const { encryptedEmail } = input;
|
||||
|
||||
const decryptedEmail = decryptSecondaryData(email);
|
||||
const decryptedEmail = decryptSecondaryData(encryptedEmail);
|
||||
|
||||
return await sendConfirmationToken({ email: decryptedEmail ?? '' }); // TODO: fix this tomorrow
|
||||
if (!decryptedEmail) {
|
||||
throw new Error('Email is required');
|
||||
}
|
||||
|
||||
return await sendConfirmationToken({ email: decryptedEmail });
|
||||
} catch (err) {
|
||||
let message = 'We were unable to send a confirmation email. Please try again.';
|
||||
|
||||
|
||||
@ -30,9 +30,9 @@ export const ZResetPasswordFormSchema = z.object({
|
||||
password: z.string().min(6),
|
||||
token: z.string().min(1),
|
||||
});
|
||||
// TODO: revisit this
|
||||
|
||||
export const ZConfirmEmailMutationSchema = z.object({
|
||||
email: z.string().min(1),
|
||||
encryptedEmail: z.string().min(1),
|
||||
});
|
||||
|
||||
export type TRetrieveUserByIdQuerySchema = z.infer<typeof ZRetrieveUserByIdQuerySchema>;
|
||||
|
||||
Reference in New Issue
Block a user