auth: e-mail + password login with e-mailed password links
CI / test (push) Failing after 1m39s
CI / build (push) Skipped
CI / deploy (push) Skipped

Sign-up asks no password: a link goes to the address and the password is
set there (also for forgotten passwords), by whoever opens the mailbox.
So nobody can register a password for someone else's address, and linking
Google or Apple to an account with the same address stays safe. Opening
the link confirms the address, ends other sessions and logs in.

Sign-up answers alike for registered addresses (the owner gets an
'account exists' link), links are limited to one per kind a minute and
five an hour, and unconfirmed password accounts cannot log in.
Frontend: login form with sign-up and forgotten password next to the
social buttons, and the /jelszo page for the link. Still behind
PASSWORD_LOGIN (off on prod).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-21 18:24:48 +00:00
co-authored by Claude Opus 5.5
parent a63f8f9928
commit 7d6a6c3d92
11 changed files with 651 additions and 192 deletions
+24 -8
View File
@@ -91,20 +91,36 @@ pub fn render(template: &str, locale: &str, payload: &Value) -> Result<Rendered,
};
let content = match (template, lang) {
("verify_email", Lang::Hu) => Content::simple(
"Erősítsd meg az e-mail-címed".into(),
"Add meg a jelszavad".into(),
greeting(name(payload, "display_name")),
"Köszönjük, hogy regisztráltál a Sorsfonalakon! Az alábbi gombbal erősítsd meg az e-mail-címed.".into(),
"E-mail-cím megerősítése",
"Köszönjük, hogy regisztráltál a Sorsfonalakon! Az alábbi gombbal megerősíted az e-mail-címed, és megadhatod a jelszavad. Utána már be is vagy lépve.".into(),
"Jelszó megadása",
url,
"A link 3 napig érvényes. Ha nem te regisztráltál, nyugodtan hagyd figyelmen kívül ezt a levelet.",
"A link 3 napig érvényes, és csak egyszer használható. Ha nem te regisztráltál, nyugodtan hagyd figyelmen kívül ezt a levelet.",
),
("verify_email", Lang::En) => Content::simple(
"Confirm your e-mail address".into(),
"Set your password".into(),
greeting(name(payload, "display_name")),
"Thanks for signing up for Sorsfonalak! Please confirm your e-mail address with the button below.".into(),
"Confirm e-mail address",
"Thanks for signing up for Sorsfonalak! The button below confirms your e-mail address and lets you set your password. You will be logged in right after.".into(),
"Set password",
url,
"The link is valid for 3 days. If you did not sign up, you can safely ignore this e-mail.",
"The link is valid for 3 days and can be used once. If you did not sign up, you can safely ignore this e-mail.",
),
("account_exists", Lang::Hu) => Content::simple(
"Már van fiókod a Sorsfonalakon".into(),
greeting(name(payload, "display_name")),
"Ezzel az e-mail-címmel regisztrációt kezdtek a Sorsfonalakon, de neked már van fiókod. Beléphetsz úgy, ahogy eddig (például Google-lel), vagy az alábbi gombbal jelszót adhatsz meg.".into(),
"Jelszó megadása",
url,
"A link 1 óráig érvényes, és csak egyszer használható. Ha nem te voltál, hagyd figyelmen kívül ezt a levelet: a fiókod nem változik.",
),
("account_exists", Lang::En) => Content::simple(
"You already have a Sorsfonalak account".into(),
greeting(name(payload, "display_name")),
"Someone started signing up for Sorsfonalak with this e-mail address, but you already have an account. Log in as before (e.g. with Google), or set a password with the button below.".into(),
"Set password",
url,
"The link is valid for 1 hour and can be used once. If it was not you, ignore this e-mail: your account stays the same.",
),
("reset_password", Lang::Hu) => Content::simple(
"Új jelszó megadása".into(),