mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
chore: encrypt and decrypt email addr
This commit is contained in:
@ -18,7 +18,7 @@ export default function UnverifiedAccount() {
|
||||
const searchParams = useSearchParams();
|
||||
const { toast } = useToast();
|
||||
|
||||
const token = searchParams?.get('t') ?? '';
|
||||
const encryptedEmail = searchParams?.get('t') ?? ''; // TODO: choose a better name instead of t
|
||||
|
||||
const { mutateAsync: sendConfirmationEmail } = trpc.profile.sendConfirmationEmail.useMutation();
|
||||
|
||||
@ -26,9 +26,7 @@ export default function UnverifiedAccount() {
|
||||
try {
|
||||
setIsButtonDisabled(true);
|
||||
|
||||
// TODO: decrypt email and send it
|
||||
|
||||
await sendConfirmationEmail({ email: token ?? '' });
|
||||
await sendConfirmationEmail({ email: encryptedEmail });
|
||||
|
||||
toast({
|
||||
title: 'Success',
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { TRPCError } from '@trpc/server';
|
||||
|
||||
import { decryptSecondaryData } from '@documenso/lib/server-only/crypto/decrypt';
|
||||
import { forgotPassword } from '@documenso/lib/server-only/user/forgot-password';
|
||||
import { getUserByEmail } from '@documenso/lib/server-only/user/get-user-by-email';
|
||||
import { getUserById } from '@documenso/lib/server-only/user/get-user-by-id';
|
||||
@ -136,7 +137,9 @@ export const profileRouter = router({
|
||||
try {
|
||||
const { email } = input;
|
||||
|
||||
return await sendConfirmationToken({ email });
|
||||
const decryptedEmail = decryptSecondaryData(email);
|
||||
|
||||
return await sendConfirmationToken({ email: decryptedEmail ?? '' }); // TODO: fix this tomorrow
|
||||
} 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().email().min(1),
|
||||
email: z.string().min(1),
|
||||
});
|
||||
|
||||
export type TRetrieveUserByIdQuerySchema = z.infer<typeof ZRetrieveUserByIdQuerySchema>;
|
||||
|
||||
Reference in New Issue
Block a user