fix: add command to release a retired learner's email for reuse - #460
Open
rahulkanneri-2u wants to merge 4 commits into
Open
fix: add command to release a retired learner's email for reuse#460rahulkanneri-2u wants to merge 4 commits into
rahulkanneri-2u wants to merge 4 commits into
Conversation
naincy128
approved these changes
Sep 7, 2026
Alam-2U
approved these changes
Sep 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A retired learner's original email is permanently blocked from re-registration, because
is_email_retired()still finds a
Userrow 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'shashed email with a placeholder (
retired_email_<user_id>@<RETIRED_EMAIL_DOMAIN>), clearing that match so theoriginal address becomes reusable. The
UserRetirementStatusrow and retirement history are left untouched.Exposed via a new
release_retired_user_emailmanagement command (--usernameor--user_id) forOperator/Support use. No automatic trigger (waffle flag, API hook) is wired up so this is manual only, for now.
Supporting information
Testing instructions
COMPLETEstate.is_email_retired("learner@example.com")=>True../manage.py lms release_retired_user_email --username <retired_username>is_email_retired("learner@example.com")=>False; confirm re-registration succeeds.pytest openedx/core/djangoapps/user_api/accounts/tests/test_utils.py openedx/core/djangoapps/user_api/management/tests/test_release_retired_user_email.pyDeadline
None.
Other information
None.