/** * Renders the email carrying a password reset link. `requestPasswordReset` * (`password-reset-service.ts`) sends it, in the instance's style and * language: whoever asks isn't signed in, so their own settings don't apply. * * @module */ import { DEFAULT_STYLE, EMAIL_LOCALE, OG_SITE_NAME } from "../config.ts"; import { EmailKit, esc, type RenderedEmail } from "./layout.ts"; import { STRINGS } from "./strings.ts"; /** * Returns the reset email of `username`, whose button opens `resetUrl`. The * link stays usable for `hours`, which the email states. */ export function renderPasswordResetEmail( username: string, resetUrl: string, hours: number, ): RenderedEmail { const t = STRINGS[EMAIL_LOCALE].reset; const kit = new EmailKit( { style: DEFAULT_STYLE, scheme: "auto" }, EMAIL_LOCALE, ); const subject = t.subject(OG_SITE_NAME); const urlBox = `