Project

General

Profile

Actions

Sub-Task #308

open

Epic #105: Account & Preferences Management

Feature #106: Update profile information

User Story #107: As a user, I want to update my account information, so that my profile stays up-to-date.

Email change confirmation flow

Sub-Task #308: Email change confirmation flow

Added by Bricklou 22 days ago. Updated 22 days ago.

Status:
In Review
Priority:
Normal
Assigned To:
Target version:
Start date:
11/03/2026
Due date:
% Done:

100%

Estimated time:

Description

Technical specification of how an account changes its email address.

Request (POST /api/v1/me/email-change):

  • The body carries the new address, the current password and, when the account has an authenticator app, its code (totp_code). A code works once.
  • Rate limit: shared with the password change, per account.
  • The new address is kept aside, one pending change per account; a new request replaces the previous one. The account keeps its current address.
  • An account that signs in through a login provider is refused.

Links:

  • The worker issues the tokens after the request event, so no secret travels on the event bus. Only hashes are stored.
  • The new address receives a confirm link.
  • The current address receives a cancel link. Without an authenticator app it also receives an approve link.
  • The links carry their token in the URL fragment. The public endpoints are POST /api/v1/authentication/verify-email-change, approve-email-change and cancel-email-change, with the token in the body.
  • Links work for 24 hours. A confirm or approve link can be followed again while the other side is awaited; the cancel link works until the change applies.

Applying:

  • The change applies when the new address confirmed and, if required, the current address approved, in any order. Both links must be unexpired.
  • The new address is stored as verified. The change is written to the change log and announced as a profile change.
  • Every session of the account ends.
  • An address taken by another account in the meantime refuses the change.

State:

  • GET /api/v1/me returns the pending change: the new address, whether the new address still has to confirm and whether the current address still has to approve.
  • DELETE /api/v1/me/email-change cancels it from a session.

Acceptance criteria:

  • Password and authenticator code are checked before anything is stored.
  • Without an authenticator app both addresses must agree; with one, the new address alone confirms.
  • Every state change is covered by a test, with a real database.
  • The mails are covered by a handler test each, and read well on a phone.

Known limit: a security key alone does not count as a second factor here; such an account is treated as having none.

Actions

Also available in: PDF Atom