Treat email addresses that differ only in letter case as the same closes #666 #686

Merged
simon merged 4 commits from issue/mitgliederverwaltung-666 into main 2026-11-14 11:03:27 +01:00
Owner

closes #666

Description of the implemented changes

The changes were:

  • Bugfixing
  • New Feature
  • Breaking Change
  • Refactoring

Email addresses: Lea@example.org and lea@example.org are one address everywhere a member or join request is looked up or checked, so no second member, no duplicate join request and no linked account can slip in through a different letter case, while addresses stay stored and shown as entered.

What has been changed?

  • Treat email addresses that differ only in case as the same
  • Refuse a member whose email differs from another's only in case
  • Note that member emails are unique regardless of letter case

Definition of Done

Code Quality

  • No new technical depths
  • Linting passed
  • Documentation is added were needed

Accessibility

  • New elements are properly defined with html-tags
  • Colour contrast follows WCAG criteria
  • Aria labels are added when needed
  • Everything is accessible by keyboard
  • Tab-Order is comprehensible
  • All interactive elements have a visible focus

Testing

  • Tests for new code are written
  • All tests pass
  • axe-core dev tools show no critical or major issues

Additional Notes

  • Mv.Membership.EmailMatch is the one place that decides whether two addresses are the same (Ash expression, query filter, member lookup, in-memory check). The join flow, the join request page, the account–member email validation and the linking suggestion use it.
  • The join flow sends its "already a member" / "already pending" notices and the confirmation resend to the stored address of the matched record, never to the variant typed into the public form — a stranger typing VICTIM@x must not receive mail or a confirmation link meant for victim@x. Tests send the variant and check the recipient.
  • Members get a unique index on lower(email) (members_unique_email_lower_index, reported as "has already been taken" on email). The exact unique index stays, because the seeds upsert members with ON CONFLICT (email).
  • Upgrade can stop: the migration first looks for members whose addresses differ only in case and, if there are any, stops before changing anything and lists each group with member ids (upgrade note in the CHANGELOG with a pre-check query). The upgrade-path fixture contains such a pair on purpose; the upgrade test now walks the operator path (stop, fix one address, upgrade again).
  • Larger commits: "Treat email addresses that differ only in case as the same" (12 files, ~340 lines, mostly tests) and "Refuse a member whose email differs from another's only in case" (9 files, ~600 lines incl. the resource snapshot and the migration tests).

Release: 1.6.0 (wave 1).

Proposed news entry (for the release file once #683 is merged):

  • Title: Email addresses no longer depend on letter case
  • Sentence: Mila now recognises Lea@example.org and lea@example.org as the same address, so members, join requests and accounts can no longer be duplicated through a different spelling.
  • Area: Members / join requests
  • Action needed: only if the update stops — then change or merge the members it lists and update again
  • Link: #666
closes #666 ## Description of the implemented changes The changes were: - [x] Bugfixing - [ ] New Feature - [ ] Breaking Change - [ ] Refactoring Email addresses: `Lea@example.org` and `lea@example.org` are one address everywhere a member or join request is looked up or checked, so no second member, no duplicate join request and no linked account can slip in through a different letter case, while addresses stay stored and shown as entered. ## What has been changed? - Treat email addresses that differ only in case as the same - Refuse a member whose email differs from another's only in case - Note that member emails are unique regardless of letter case ## Definition of Done ### Code Quality - [ ] No new technical depths - [x] Linting passed - [x] Documentation is added were needed ### Accessibility - [ ] New elements are properly defined with html-tags - [ ] Colour contrast follows WCAG criteria - [ ] Aria labels are added when needed - [ ] Everything is accessible by keyboard - [ ] Tab-Order is comprehensible - [ ] All interactive elements have a visible focus ### Testing - [x] Tests for new code are written - [x] All tests pass - [ ] axe-core dev tools show no critical or major issues ## Additional Notes - `Mv.Membership.EmailMatch` is the one place that decides whether two addresses are the same (Ash expression, query filter, member lookup, in-memory check). The join flow, the join request page, the account–member email validation and the linking suggestion use it. - The join flow sends its "already a member" / "already pending" notices and the confirmation resend to the **stored** address of the matched record, never to the variant typed into the public form — a stranger typing `VICTIM@x` must not receive mail or a confirmation link meant for `victim@x`. Tests send the variant and check the recipient. - Members get a unique index on `lower(email)` (`members_unique_email_lower_index`, reported as "has already been taken" on `email`). The exact unique index stays, because the seeds upsert members with `ON CONFLICT (email)`. - **Upgrade can stop**: the migration first looks for members whose addresses differ only in case and, if there are any, stops before changing anything and lists each group with member ids (upgrade note in the CHANGELOG with a pre-check query). The upgrade-path fixture contains such a pair on purpose; the upgrade test now walks the operator path (stop, fix one address, upgrade again). - Larger commits: "Treat email addresses that differ only in case as the same" (12 files, ~340 lines, mostly tests) and "Refuse a member whose email differs from another's only in case" (9 files, ~600 lines incl. the resource snapshot and the migration tests). Release: 1.6.0 (wave 1). Proposed news entry (for the release file once #683 is merged): - Title: Email addresses no longer depend on letter case - Sentence: Mila now recognises `Lea@example.org` and `lea@example.org` as the same address, so members, join requests and accounts can no longer be duplicated through a different spelling. - Area: Members / join requests - Action needed: only if the update stops — then change or merge the members it lists and update again - Link: #666
simon merged commit 42a39d3d6d into main 2026-11-14 11:03:27 +01:00
simon deleted branch issue/mitgliederverwaltung-666 2026-11-14 11:03:27 +01:00
Sign in to join this conversation.
No description provided.