# Login code email template

URL: https://samva.dev/templates/login-code

Sign someone in with one button and the same sign-in as a code to type, with the device, place and time of the request underneath.

## Guidance

- Supply the product name, the account, the sign-in link and the code from your authentication flow. The button and the code are the same sign-in, so a reader on a different device can type what they cannot click.
- State the validity window in the expiry notice. The template never reads the clock, so keep that sentence aligned with the token you issued. The request details are a list of label and value, so a short request and a long one render from the same source.
- The footer says what happens if the reader does nothing and links to the account's security page. Your application issues the link and the code, limits attempts and enforces one use.
- It is written for Plinth, a fictional platform for deploying web apps. Replace its mark and the sign-in pictogram with your own, and restyle through the theme tokens in starter.css. Edit the email in the AI email editor.

## Variables

| Variable | Meaning |
| --- | --- |
| account | The address or username being signed in, for example maya@halyard.example. Shown in the body and the footer. |
| code | The code to type on the sign-in page, as a string such as “WQTR-8842”. It must complete the same sign-in as the link. |
| expiryNotice | For example: “The link and the code work once, until 09:24 CEST.” Derive it from the real token lifetime; the template never reads the clock. |
| loginUrl | The complete HTTPS sign-in URL from your auth system. The button opens it in the browser the reader clicks from. |
| productName | The product the reader is signing in to, for example “Plinth”. |
| requestDetails | A list of { label, value } objects, for example { "label": "Device", "value": "Firefox 144 on Ubuntu 24.04" }. Include only context your application recorded. |
| securityUrl | Your account-security page. Require authentication before it shows account activity. |
