Verify every email address by a message with a unique link or code; keep one primary among several #3
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Postulo/postulo#3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Observation
What happens today
Several addresses, one primary — already exists. django-allauth's
EmailAddressmodel holds any number of addresses per account with exactly one flaggedprimary, and the management page is at/accounts/email/, linked from Your details as "Email addresses". It renders inside Postulo's own shell (templates/account/base_manage_email.html). Worth confirming the flow — add, verify, make primary, remove — against the observation rather than assuming, but the mechanism is there.Verification is not required.
src/postulo/config/settings/base.pysetsACCOUNT_EMAIL_VERIFICATION = "optional": a verification message is sent when an address is added, but nothing is refused if it is never acted on. An unverified address signs in, becomes primary, and receives password resets. That is the gap.Verification is by link. allauth 65.19.2 (the installed version) also supports a code typed into a form:
ACCOUNT_EMAIL_VERIFICATION_BY_CODE_ENABLED = True, withACCOUNT_EMAIL_VERIFICATION_BY_CODE_MAX_ATTEMPTS. It is one or the other, not both.What changes
ACCOUNT_EMAIL_VERIFICATION = "mandatory": an address must be verified before it can be used to sign in or made primary.ACCOUNT_EMAIL_VERIFICATION_BY_CODE_ENABLEDaccordingly; considerACCOUNT_LOGIN_ON_EMAIL_CONFIRMATIONfor the signup path.ACCOUNT_MAX_EMAIL_ADDRESSESso an account cannot accumulate addresses without bound.createsuperusercreates noEmailAddressrow at all, so under mandatory the first administrator could be locked out until they verify — and on an instance whose SMTP is not yet configured, could never verify. Needs either a verifiedEmailAddresscreated alongside the superuser, or a management command to mark an address verified by hand.emailas a verified primaryEmailAddress, so upgrading does not lock anybody out.Why this is a breaking change
It is a change in what an operator must provide. Today an instance runs with no email at all; afterwards, without working SMTP, nobody new can complete signup and an unverified existing account cannot sign in. The upgrade needs the grandfathering migration above and a clear note in the changelog.
A related thing to verify while here
Under today's optional setting a verification message is still sent at signup. The production settings default SMTP to
localhost:25. Whether a failed send aborts an invited signup with an error, or is swallowed, has not been checked — the test instance on ragnar has no SMTP configured, so it is the place to find out.Open questions
Related: #1 (username as identifier, email as alternative sign-in) and #2 (obligatory full name).