Skip to content

Conversation

@ccantillo
Copy link
Collaborator

Description

This pull request enables retired usernames and emails to be reused for new user registrations, and prevents duplicate key errors when users with the same original credentials retire multiple times.

What Changed

1. Allow Credential Reuse After Retirement

  • Modified is_username_retired() and is_email_retired() functions to return False, allowing previously retired credentials to be available for new registrations
  • This means when a user retires their account (username: student, email: student@example.com), a completely new user can later register with those same credentials

2. Fix Duplicate Key Error on Multiple Retirements

  • Updated retirement process to include the user ID in retired credentials (e.g., retired__user_5_student@retired.invalid instead of retired__user_hash@retired.invalid)
  • This ensures that when multiple users retire and re-register with the same original credentials, each retirement creates unique database entries

Why These Changes

Previously, the system prevented any reuse of retired credentials to protect against identity confusion. However, this created a permanent "lock" on usernames and emails, preventing legitimate new users from using popular or common credentials that had been retired.

The new approach:

  • ✅ Allows credential reuse for fresh, independent accounts
  • ✅ Maintains audit trail in user_api_userretirementstatus table
  • ✅ Prevents database conflicts when the same credentials are retired multiple times

@ccantillo ccantillo requested a review from johanseto January 5, 2026 20:44
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.

2 participants