EmailChangeService

class EmailChangeService[source]

Methods

confirm_new

Verify the new-email code and complete the email change.

confirm_old

Verify the old-email code and send a code to the new email.

create

Initiate an email change.

confirm_new(json_body, *, token)[source]

Verify the new-email code and complete the email change.

Only valid for sessions in pending_new_confirm status. On success, the user’s email is updated and marked as verified.

Does not require authentication — the token in the URL is the credential. IP-bound to the initiating client.

Parameters:
Returns:

The new email address.

Return type:

EmailChangeDoneResponse

confirm_old(json_body, *, token)[source]

Verify the old-email code and send a code to the new email.

Only valid for sessions in pending_old_confirm status (Path B: no-password users). On success, transitions to pending_new_confirm and sends a code to the new email. Call email_change.confirm_new next.

Does not require authentication — the token in the URL is the credential. IP-bound to the initiating client.

Parameters:
Returns:

An empty response on success.

Return type:

EmailChangeConfirmOldResponse

create(json_body)[source]

Initiate an email change.

If the user has a password and provides old_password, the flow skips old-email verification and goes straight to new-email verification (call email_change.confirm_new).

If the user has no password (SSO/LTI), old-email verification is required first (call email_change.confirm_old, then email_change.confirm_new).

Parameters:
Returns:

An email change session identifier.

Return type:

EmailChangeResponse