| 1 | // The approved copy for email sign-in, by review id. The strings are the |
| 2 | // reviewed text byte for byte; TestSigninCopyMatchesApproved pins this map to |
| 3 | // docs/superpowers/specs/2026-10-21-console-email-signin-copy-approved.json. |
| 4 | package console |
| 5 | |
| 6 | import "strings" |
| 7 | |
| 8 | // signinCopy holds every approved string by its review id. |
| 9 | var signinCopy = map[string]string{ |
| 10 | "home.email_label": "Your email address", |
| 11 | "home.email_placeholder": "you@example.com", |
| 12 | "home.email_button": "Continue", |
| 13 | "home.small": "New here or coming back, it's the same form. Keymail addresses sign in with Keymail. Any other address gets a link and a code by email, and your first sign-in sets up your account. No passwords.", |
| 14 | "home.invite_prompt": "Sign in as {address} to accept your invitation.", |
| 15 | "home.cli_prompt": "Sign in to approve your terminal.", |
| 16 | "home.bad_address": "That doesn't look like an email address.", |
| 17 | "home.no_mail": "This console can't send email yet, so it can only sign in Keymail addresses for now.", |
| 18 | "check.title": "Check your email", |
| 19 | "check.sent": "A sign-in link and code are on their way to {address}. Both work once, for 15 minutes.", |
| 20 | "check.code_label": "Or type the code from the email", |
| 21 | "check.code_button": "Sign in", |
| 22 | "check.code_wrong": "That code doesn't match. Check the email and try again.", |
| 23 | "check.code_used_up": "That code has expired or had too many wrong tries. Ask for a new link below.", |
| 24 | "check.code_throttled": "Too many wrong codes for this address. Use the link in the email, or try again later.", |
| 25 | "check.nothing": "Nothing arriving? Check your spam folder, or ask for a new link. You can ask once a minute.", |
| 26 | "check.again_button": "Send a new link", |
| 27 | "link.title": "Sign in as {address}?", |
| 28 | "link.button": "Sign in", |
| 29 | "link.expired": "That sign-in link has expired or was already used. Ask for a new one from the front page.", |
| 30 | "link.wrong_site": "That sign-in didn't come from this page, so we stopped it. Open the link from your email again.", |
| 31 | "stepup.title": "Confirm it's you", |
| 32 | "stepup.sent": "To finish this, we've sent a link and a code to {address}. They work for 10 minutes, and only in this browser. Nothing has changed yet.", |
| 33 | "stepup.code_label": "Type the code from the email", |
| 34 | "stepup.code_button": "Confirm", |
| 35 | "stepup.link_title": "Confirm it's you", |
| 36 | "stepup.link_button": "Confirm and continue", |
| 37 | "stepup.wrong_browser": "Open this link in the browser where you started, or type the code there. Nothing has changed.", |
| 38 | "stepup.expired": "That confirmation has expired or was already used. Nothing has changed. Try the action again.", |
| 39 | "email.signin.subject": "Your sign-in link for {console}", |
| 40 | "email.signin.body": "Someone, hopefully you, asked to sign in to {console} as {address}.\n\nOpen this link to sign in:\n\n{link}\n\nOr type this code on the page that's waiting: {code}\n\nThe link and the code work once, for 15 minutes. If this wasn't you, ignore this email. Nothing happens without the link or the code.", |
| 41 | "email.stepup.subject": "Confirm it's you on {console}", |
| 42 | "email.stepup.body": "Someone signed in to {console} as {address} started an action that needs you to confirm it's you.\n\nOpen this link in the same browser to confirm:\n\n{link}\n\nOr type this code there: {code}\n\nThey work once, for 10 minutes. If this wasn't you, don't confirm. Sign in again and check your account's members and command line logins.", |
| 43 | "email.invite.body": "{inviter} invited you to the account \"{account}\" on {console}.\n\nOpen this link to accept. You'll sign in as {to} first if you aren't already:\n\n{link}\n\nIt works once and expires in 7 days. If you weren't expecting this, ignore it. Nothing happens without the link.", |
| 44 | "team.confirm_note": "Removing a member, handing over ownership and deleting the account each ask you to confirm it's you. A signed-in browser on its own isn't enough.", |
| 45 | "team.invite_placeholder": "them@example.com", |
| 46 | "team.invite_note": "We send the invitation by email, or to Keymail for Keymail addresses. It works once and expires in 7 days.", |
| 47 | "team.bad_address": "That doesn't look like an email address.", |
| 48 | } |
| 49 | |
| 50 | // copyText returns the approved string for id with each {key} placeholder |
| 51 | // replaced by its value (kv is key, value, key, value, ...). An unknown id is |
| 52 | // a programming error and panics, so a typo cannot ship blank copy. |
| 53 | func copyText(id string, kv ...string) string { |
| 54 | text, ok := signinCopy[id] |
| 55 | if !ok { |
| 56 | panic("console: unknown copy id " + id) |
| 57 | } |
| 58 | if len(kv)%2 != 0 { |
| 59 | panic("console: copyText " + id + ": odd number of placeholder arguments") |
| 60 | } |
| 61 | pairs := make([]string, 0, len(kv)) |
| 62 | for i := 0; i < len(kv); i += 2 { |
| 63 | pairs = append(pairs, "{"+kv[i]+"}", kv[i+1]) |
| 64 | } |
| 65 | return strings.NewReplacer(pairs...).Replace(text) |
| 66 | } |
| 67 | |