mirror of
https://github.com/bitbaum/fleet.git
synced 2026-12-04 05:30:18 +01:00
The account mails stay this app's own words, in the reader's language, with
HTML: the template is handed to createAuthMailer({ render, codes: true })
(AccountKit 0.26.1). The shared mailer checks the link's origin, skips
addresses that cannot receive mail and puts a six-digit code in the sign-in
link's email, which the template prints ("On another device? Type this
code ..."). The sign-in page then offers the field for it.
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9
Co-authored-by: Claude <noreply@anthropic.com>
20 lines
800 B
TypeScript
20 lines
800 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { authMail, renderAuthMail } from "./mail";
|
|
import { SITE } from "@/lib/site";
|
|
|
|
describe("the sign-in code in the sign-in link's email", () => {
|
|
const link = `${SITE.url}/api/auth/magic-link/verify?token=t&callbackURL=%2Fde%2Faccount`;
|
|
|
|
it("is printed in the reader's language, in the text and the HTML", () => {
|
|
const mail = renderAuthMail("magicLink", link, "de", "123456");
|
|
expect(mail.text).toContain("123 456");
|
|
expect(mail.html).toContain("123 456");
|
|
expect(mail.text).toContain("Gerät");
|
|
});
|
|
|
|
it("is left out when there is none, and the shared mailer says it prints one", () => {
|
|
expect(renderAuthMail("magicLink", link, "en").text).not.toMatch(/\d{3} \d{3}/);
|
|
expect(authMail.codes).toBe(true);
|
|
});
|
|
});
|