Send the login code as a formatted mail - #20
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20 +/- ##
============================================
+ Coverage 86.67% 86.75% +0.07%
- Complexity 567 574 +7
============================================
Files 63 64 +1
Lines 1959 1985 +26
============================================
+ Hits 1698 1722 +24
- Misses 261 263 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
alistair3149
force-pushed
the
format-the-login-code-email
branch
from
August 21, 2026 20:31
4d19a76 to
681378b
Compare
alistair3149
changed the base branch from
code-screen-address-and-resend
to
master
August 21, 2026 20:31
alistair3149
force-pushed
the
format-the-login-code-email
branch
4 times, most recently
from
August 21, 2026 20:51
0ab1cc6 to
b391a50
Compare
Member
Author
The code arrived as five lines of unstyled text, with nothing in it to say which wiki had sent it or that the eight digits in the middle were the point. It read like something to be deleted unread, which is a poor start for the one message standing between a member and their account. Send it as a formatted part with a plain-text alternative: the wiki's name, the code set apart in a panel of its own, how long it lasts, and what to do if it was not you. The plain part is rewritten to say the same, since a wiki that has not turned formatted mail on sends only that one. The formatted part is a Mustache template, so what it looks like is changed by editing markup rather than by concatenating strings in PHP. What a mail client will and will not lay out is written down there rather than here. MediaWiki keeps the formatted part only where $wgAllowHTMLEmail is on, which it is not by default. That setting governs every mail a wiki sends, so the README says to set it rather than the extension setting it, which is what Echo does with it too. The code is shown in groups of four so it can be held in the head between the mail and the form. That is a display alone: a member who copies the spaces along with the digits is no longer refused their own code. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
alistair3149
force-pushed
the
format-the-login-code-email
branch
from
August 21, 2026 21:03
b391a50 to
65f579b
Compare
alistair3149
marked this pull request as ready for review
August 21, 2026 21:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


The code arrived as five lines of unstyled text, with nothing in it to say which wiki had sent it or
that the eight digits in the middle were the point. It read like something to be deleted unread,
which is a poor start for the one message standing between a member and their account.
Send it as a formatted part with a plain-text alternative: the wiki's name, the code set apart in a
panel of its own, how long it lasts, and what to do if it was not you. The plain part carries the
same code and the same warning rather than a note that the mail is better read elsewhere, since for
many wikis it is the only part that ships.
The formatted part is a Mustache template, so what it looks like is changed by editing markup rather
than by concatenating strings in PHP. It is table layout and inline styles throughout, because a
mail client is not a browser and the classic Outlook still in use across the companies this
extension serves lays out with Word's engine. Every string reaches it already localised, and
Mustache escapes what it interpolates, so a wiki's site name cannot carry markup into the mail.
Nothing in it is fetched from the network. No link, since a login mail that trains its reader to
click one is a phishing template with a head start, and no image, since clients block remote ones by
default and would show a broken box where a logo went.
MediaWiki keeps the formatted part only where
$wgAllowHTMLEmailis on, which it is not by default.That setting governs every mail a wiki sends, so it is recommended in the README rather than set
here, which is what Echo does with it too. Without it the code still arrives, as the plain part
alone.
The code is shown in groups of four so it can be held in the head between the mail and the form.
That is a display alone: a member who copies the spaces along with the digits is no longer refused
their own code.
Considered, omitted:
$wgAllowHTMLEmailfrom the extension, which would reformat every mail the wiki sendsputs the code on a locked screen — left as it was, and worth deciding on its own
Verified by sending a real code through the dev wiki and reading both parts out of the mailbox,
rather than only in tests.