Skip to content

fix: add command to release a retired learner's email for reuse - #460

Open
rahulkanneri-2u wants to merge 4 commits into
release-ulmofrom
lp-1177-release-retired-learner-email
Open

fix: add command to release a retired learner's email for reuse#460
rahulkanneri-2u wants to merge 4 commits into
release-ulmofrom
lp-1177-release-retired-learner-email

Conversation

@rahulkanneri-2u

@rahulkanneri-2u rahulkanneri-2u commented Sep 7, 2026

Copy link
Copy Markdown

Description

A retired learner's original email is permanently blocked from re-registration, because is_email_retired()
still finds a User row whose email matches the retired-hash of that address.

This adds release_retired_learner_email(user) (accounts/utils.py), which replaces a fully-retired user's
hashed email with a placeholder (retired_email_<user_id>@<RETIRED_EMAIL_DOMAIN>), clearing that match so the
original address becomes reusable. The UserRetirementStatus row and retirement history are left untouched.

Exposed via a new release_retired_user_email management command (--username or --user_id) for
Operator/Support use. No automatic trigger (waffle flag, API hook) is wired up so this is manual only, for now.

Supporting information

Testing instructions

  1. Retire a test user to the COMPLETE state.
  2. is_email_retired("learner@example.com") => True.
  3. ./manage.py lms release_retired_user_email --username <retired_username>
  4. is_email_retired("learner@example.com") => False; confirm re-registration succeeds.
  5. pytest openedx/core/djangoapps/user_api/accounts/tests/test_utils.py openedx/core/djangoapps/user_api/management/tests/test_release_retired_user_email.py

Deadline

None.

Other information

None.

Comment thread openedx/core/djangoapps/user_api/accounts/utils.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants