fix(auth): a code's mail names its purpose in the subject

A notification shows a mail's subject alone, and the subject said only
"K7QX-M2PD is your Halkyon Learn code" whatever the code would do (the
third reading). The subject now says it: to create an account, finish
setting it up, switch off the authenticator, reset or delete the account.
The sign-up mail also says that the code gives a password to an account
that has the address and none yet, as signing up does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-21 10:44:10 +02:00
commit ad52da5a94
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -83,7 +83,9 @@ final class LogCodeMailer implements CodeMailer {
/// into, and [instance] the instance's address. The mail says what the code
/// would do ([purpose]: the re-review's seventh finding), so that whoever
/// is asked for it by another than [app] on [instance] sees what they would
/// hand over, and that only there may it be typed.
/// hand over, and that only there may it be typed; its subject names the
/// purpose too, as a notification shows the subject alone (the third
/// reading).
({String subject, String body}) codeMail({
required String code,
required EmailCodePurpose purpose,
@ -93,12 +95,21 @@ final class LogCodeMailer implements CodeMailer {
}) => switch (language) {
'de' => (
// A compound with the name, hyphenated through: Halkyon-Learn-Code.
subject: '$code ist dein ${app.replaceAll(' ', '-')}-Code',
subject:
'$code: dein ${app.replaceAll(' ', '-')}-Code, ${switch (purpose) {
EmailCodePurpose.signUp => 'um ein Konto anzulegen',
EmailCodePurpose.finishSetup => 'um dein Konto fertig einzurichten',
EmailCodePurpose.authenticatorReset => 'um deine Authenticator-App abzuschalten',
EmailCodePurpose.accountReset => 'um dein Konto zurückzusetzen',
EmailCodePurpose.deletion => 'um dein Konto zu löschen',
}}',
body:
'$code\n'
'\n'
'Gib diesen Code in $app ein, ${switch (purpose) {
EmailCodePurpose.signUp => 'um dein Konto auf $instance anzulegen',
EmailCodePurpose.signUp => 'um dein Konto auf $instance anzulegen (oder, hat '
'dort schon ein Konto diese Adresse und noch kein Passwort, '
'ihm eines zu geben)',
EmailCodePurpose.finishSetup => 'um die Einrichtung deines Kontos auf $instance abzuschließen',
EmailCodePurpose.authenticatorReset => 'um die Codes deiner Authenticator-App für dein Konto auf '
'$instance abzuschalten (72 Stunden später)',
@ -118,12 +129,20 @@ final class LogCodeMailer implements CodeMailer {
'schreibt ihr nur, wenn du einen Code anforderst.\n',
),
_ => (
subject: '$code is your $app code',
subject:
'$code: your $app code to ${switch (purpose) {
EmailCodePurpose.signUp => 'create an account',
EmailCodePurpose.finishSetup => 'finish setting up your account',
EmailCodePurpose.authenticatorReset => 'switch off your authenticator',
EmailCodePurpose.accountReset => 'reset your account',
EmailCodePurpose.deletion => 'delete your account',
}}',
body:
'$code\n'
'\n'
'Type this code in $app ${switch (purpose) {
EmailCodePurpose.signUp => 'to create your account on $instance',
EmailCodePurpose.signUp => 'to create your account on $instance (or, should an account '
'there have this address and no password yet, to give it one)',
EmailCodePurpose.finishSetup => 'to finish setting up your account on $instance',
EmailCodePurpose.authenticatorReset => "to switch off your authenticator app's codes for your account "
'on $instance (72 hours later)',