[Hotfix] Fixing direct link encoding (#6131)

This commit is contained in:
Leo Giovanetti authored and GitHub committed 2022-12-20 16:00:33 -07:00
1 parent 3b51fff88d
commit 7a6349b4c0
5 files changed
+16 -8

No files matched your search

@@ -27,7 +27,7 @@ export const CallToAction = (props: { label: string; href: string; secondary?: b
target="_blank"
rel="noreferrer">
{props.label}
<LinkIcon secondary />
<LinkIcon secondary={props.secondary} />
</a>
</p>
);
@@ -1,3 +1,4 @@
import base64url from "base64url";
import { createHmac } from "crypto";
import { CallToAction, CallToActionTable, Separator } from "../components";
@@ -7,7 +8,8 @@ const CALENDSO_ENCRYPTION_KEY = process.env.CALENDSO_ENCRYPTION_KEY || "";
export const OrganizerRequestEmail = (props: React.ComponentProps<typeof OrganizerScheduledEmail>) => {
const signedData = `${props.attendee.email}/${props.calEvent.uid}`;
const signature = createHmac("sha1", CALENDSO_ENCRYPTION_KEY).update(signedData).digest("base64");
const sha1 = createHmac("sha1", CALENDSO_ENCRYPTION_KEY).update(signedData).digest();
const signature = base64url(sha1);
return (
<OrganizerScheduledEmail
title={
@@ -24,7 +26,7 @@ export const OrganizerRequestEmail = (props: React.ComponentProps<typeof Organiz
label={props.calEvent.organizer.language.translate("accept")}
href={`${process.env.NEXT_PUBLIC_WEBAPP_URL}/booking/direct/accept/${encodeURIComponent(
props.attendee.email
)}/${encodeURIComponent(props.calEvent.uid as string)}/${encodeURIComponent(signature)}`}
)}/${encodeURIComponent(props.calEvent.uid as string)}/${signature}`}
/>
<Separator />
<CallToAction
@@ -32,7 +34,7 @@ export const OrganizerRequestEmail = (props: React.ComponentProps<typeof Organiz
secondary
href={`${process.env.NEXT_PUBLIC_WEBAPP_URL}/booking/direct/reject/${encodeURIComponent(
props.attendee.email
)}/${encodeURIComponent(props.calEvent.uid as string)}/${encodeURIComponent(signature)}`}
)}/${encodeURIComponent(props.calEvent.uid as string)}/${signature}`}
/>
</CallToActionTable>
}