Hold /privacy behind a flag until counsel reads it, and fix leftover legal and email copy.
This commit is contained in:
1 parent
ead6c8f716
commit
072e5362f5
43 files changed
+548
-191
No files matched your search
+75
-30
@@ -1,5 +1,6 @@
|
||||
import { ASSETS, getAssetPath } from "../assetUtils";
|
||||
import { MAGIC_LINK_TTL_MINUTES } from "../privacyRetention";
|
||||
import { mailLegalFooterHtml, mailLegalFooterUrls } from "./mailLegalFooter";
|
||||
|
||||
export const MAGIC_LINK_LOGO_PATH = getAssetPath(ASSETS.LOGO_MARK);
|
||||
|
||||
@@ -31,51 +32,54 @@ function originHost(origin: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
export function buildMagicLinkMail(
|
||||
input: MagicLinkMailInput,
|
||||
type BrandedVerifyMailCopy = {
|
||||
verifyUrl: string;
|
||||
origin: string;
|
||||
subject: string;
|
||||
previewText: string;
|
||||
heading: string;
|
||||
intro: string;
|
||||
buttonLabel: string;
|
||||
ignore: string;
|
||||
why: string;
|
||||
};
|
||||
|
||||
function buildBrandedVerifyMail(
|
||||
copy: BrandedVerifyMailCopy,
|
||||
): MagicLinkMailContent {
|
||||
const origin = input.origin.replace(/\/$/, "");
|
||||
const minutes = MAGIC_LINK_TTL_MINUTES;
|
||||
const subject = "Your login link for CommunityRule";
|
||||
const previewText = `It works once, for ${minutes} minutes.`;
|
||||
const heading = "Log in to CommunityRule";
|
||||
const intro = `Use the button to log in. It works once, for ${minutes} minutes.`;
|
||||
const ignore =
|
||||
"If you did not ask to log in, ignore this email. Nobody can log in without the link.";
|
||||
const origin = copy.origin.replace(/\/$/, "");
|
||||
const { aboutUrl, privacyUrl } = mailLegalFooterUrls(origin);
|
||||
const madeBy =
|
||||
"CommunityRule is made by the Media Economies Design Lab at the University of Colorado Boulder.";
|
||||
const privacyUrl = `${origin}/privacy`;
|
||||
const aboutUrl = `${origin}/about`;
|
||||
const logoUrl = `${origin}${MAGIC_LINK_LOGO_PATH}`;
|
||||
const host = originHost(origin);
|
||||
const href = escapeHtml(copy.verifyUrl);
|
||||
|
||||
const text = [
|
||||
heading,
|
||||
copy.heading,
|
||||
"",
|
||||
intro,
|
||||
copy.intro,
|
||||
"",
|
||||
`Log in: ${input.verifyUrl}`,
|
||||
`${copy.buttonLabel}: ${copy.verifyUrl}`,
|
||||
"",
|
||||
ignore,
|
||||
copy.ignore,
|
||||
"",
|
||||
madeBy,
|
||||
`Privacy ${privacyUrl}`,
|
||||
...(privacyUrl ? [`Privacy ${privacyUrl}`] : []),
|
||||
`About CommunityRule ${aboutUrl}`,
|
||||
"",
|
||||
`Sent because you asked to log in at ${host}.`,
|
||||
copy.why,
|
||||
].join("\n");
|
||||
|
||||
const href = escapeHtml(input.verifyUrl);
|
||||
const html = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<title>${escapeHtml(subject)}</title>
|
||||
<title>${escapeHtml(copy.subject)}</title>
|
||||
</head>
|
||||
<body style="margin:0;padding:0;background:#e4e4e4;">
|
||||
<div style="display:none;max-height:0;overflow:hidden;mso-hide:all;">${escapeHtml(
|
||||
previewText,
|
||||
copy.previewText,
|
||||
)}</div>
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:#e4e4e4;">
|
||||
<tr>
|
||||
@@ -95,19 +99,17 @@ export function buildMagicLinkMail(
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:40px 32px 56px;">
|
||||
<h1 style="margin:0 0 16px;font-family:'Bricolage Grotesque',Arial,sans-serif;font-size:36px;line-height:44px;font-weight:700;color:#000000;">${escapeHtml(heading)}</h1>
|
||||
<p style="margin:0 0 32px;font-family:Inter,Arial,sans-serif;font-size:18px;line-height:24px;color:#303030;">${escapeHtml(intro)}</p>
|
||||
<h1 style="margin:0 0 16px;font-family:'Bricolage Grotesque',Arial,sans-serif;font-size:36px;line-height:44px;font-weight:700;color:#000000;">${escapeHtml(copy.heading)}</h1>
|
||||
<p style="margin:0 0 32px;font-family:Inter,Arial,sans-serif;font-size:18px;line-height:24px;color:#303030;">${escapeHtml(copy.intro)}</p>
|
||||
<p style="margin:0 0 32px;">
|
||||
<a href="${href}" style="display:inline-block;background:#141414;color:#ffffff;font-family:Inter,Arial,sans-serif;font-size:16px;line-height:20px;font-weight:500;text-decoration:none;border-radius:9999px;padding:12px 16px;">Log in</a>
|
||||
<a href="${href}" style="display:inline-block;background:#141414;color:#ffffff;font-family:Inter,Arial,sans-serif;font-size:16px;line-height:20px;font-weight:500;text-decoration:none;border-radius:9999px;padding:12px 16px;">${escapeHtml(copy.buttonLabel)}</a>
|
||||
</p>
|
||||
<div style="height:1px;background:#e4e4e4;margin:0 0 32px;"></div>
|
||||
<p style="margin:0 0 32px;font-family:Inter,Arial,sans-serif;font-size:16px;line-height:24px;color:#303030;">${escapeHtml(ignore)}</p>
|
||||
<p style="margin:0 0 32px;font-family:Inter,Arial,sans-serif;font-size:16px;line-height:24px;color:#303030;">${escapeHtml(copy.ignore)}</p>
|
||||
<div style="border-top:1px solid #e4e4e4;padding-top:24px;">
|
||||
<p style="margin:0 0 12px;font-family:Inter,Arial,sans-serif;font-size:14px;line-height:20px;color:#464646;">${escapeHtml(madeBy)}</p>
|
||||
<p style="margin:0;font-family:Inter,Arial,sans-serif;font-size:14px;line-height:20px;color:#464646;">
|
||||
<a href="${escapeHtml(privacyUrl)}" style="color:#464646;text-decoration:underline;">Privacy</a>
|
||||
|
||||
<a href="${escapeHtml(aboutUrl)}" style="color:#464646;text-decoration:underline;">About CommunityRule</a>
|
||||
${mailLegalFooterHtml(origin)}
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
@@ -119,5 +121,48 @@ export function buildMagicLinkMail(
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
return { subject, previewText, text, html };
|
||||
return {
|
||||
subject: copy.subject,
|
||||
previewText: copy.previewText,
|
||||
text,
|
||||
html,
|
||||
};
|
||||
}
|
||||
|
||||
export function buildMagicLinkMail(
|
||||
input: MagicLinkMailInput,
|
||||
): MagicLinkMailContent {
|
||||
const minutes = MAGIC_LINK_TTL_MINUTES;
|
||||
const origin = input.origin.replace(/\/$/, "");
|
||||
return buildBrandedVerifyMail({
|
||||
verifyUrl: input.verifyUrl,
|
||||
origin,
|
||||
subject: "Your login link for CommunityRule",
|
||||
previewText: `It works once, for ${minutes} minutes.`,
|
||||
heading: "Log in to CommunityRule",
|
||||
intro: `Use the button to log in. It works once, for ${minutes} minutes.`,
|
||||
buttonLabel: "Log in",
|
||||
ignore:
|
||||
"If you did not ask to log in, ignore this email. Nobody can log in without the link.",
|
||||
why: `Sent because you asked to log in at ${originHost(origin)}.`,
|
||||
});
|
||||
}
|
||||
|
||||
export function buildEmailChangeMail(
|
||||
input: MagicLinkMailInput,
|
||||
): MagicLinkMailContent {
|
||||
const minutes = MAGIC_LINK_TTL_MINUTES;
|
||||
const origin = input.origin.replace(/\/$/, "");
|
||||
return buildBrandedVerifyMail({
|
||||
verifyUrl: input.verifyUrl,
|
||||
origin,
|
||||
subject: "Confirm your new CommunityRule email",
|
||||
previewText: `It works once, for ${minutes} minutes.`,
|
||||
heading: "Confirm your new email",
|
||||
intro: `Use the button to confirm the new address on your CommunityRule account. It works once, for ${minutes} minutes.`,
|
||||
buttonLabel: "Confirm email",
|
||||
ignore:
|
||||
"If you did not request this change, ignore this email. Your current login is unchanged until you confirm.",
|
||||
why: `Sent because you asked to change the email on your CommunityRule account at ${originHost(origin)}.`,
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user