You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Change-email verification rejects valid tokens because shared token decoding trims change-email state #36411
However, the shared TokenManager.get_token_data() path was still validating Redis payloads through a partial _TokenData schema that trimmed undeclared fields. That made business-specific auth metadata vulnerable to being silently dropped during the Redis -> Python round-trip.
PR #36117 fixed the adjacent generic phase field for forgot-password / email-register, but change-email does not actually depend on that key. The change-email flow depends on its dedicated email_change_phase state and, more broadly, on the ability to preserve business-specific token metadata without the storage layer stripping fields.
The old flow also relied on loose dict/string checks and did not keep the stable account_id binding explicit across every change-email transition.
Proposed fix
keep TokenManager on a shared _TokenData + TypeAdapter baseline, but configure it to allow and preserve undeclared extra fields
model change-email tokens at the AccountService boundary with Pydantic discriminated union types
bind account_id through the entire change-email flow and validate it at every transition
add regression tests for both the shared token adapter behavior and the typed change-email state machine
Activity
[-]Change-email verification rejects valid tokens because `_TokenData` drops `email_change_phase`[/-][+]Change-email verification rejects valid tokens because shared token decoding trims change-email state[/+]