Skip to content

feat: update email availability check for profile updates and migrations - #311

Merged
minh-biocommons merged 1 commit into
aaf-devfrom
aaf-change-email-tweak
Nov 9, 2026
Merged

minh-biocommons merged 1 commit into
aaf-devfrom
aaf-change-email-tweak

Conversation

@minh-biocommons

Copy link
Copy Markdown
Collaborator

Description

Add an authenticated profile email availability endpoint so the front end can check whether an email is already in use before checking institutional eligibility through AAF

Changes

  • Add GET /me/profile/email/check-availability for authenticated Auth0 and AAF users
  • Share conflict checks across profile email updates, OTP confirmation, and AAF migrations

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have added unit / integration tests that prove my fix is effective or that my feature works
  • I have run all tests locally and they pass
  • I have updated the documentation (if applicable)
  • For any new secrets, I have updated the shared spreadsheet and the GitHub Secrets.

@minh-biocommons minh-biocommons changed the title feat: implement email availability check for profile updates and migrations feat: update email availability check for profile updates and migrations Nov 9, 2026
@minh-biocommons
minh-biocommons requested a balanced review from Copilot November 9, 2026 02:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the authenticated profile email availability changes.

No open issues 🎉

What changed in this PR

Adds an authenticated profile email availability check for Auth0 and AAF users, allowing the frontend to detect conflicts before checking institutional eligibility.

Changes:

  • Adds GET /me/profile/email/check-availability with a shared availability response schema.
  • Centralizes case-insensitive conflict checks across profile updates, OTP confirmation, and AAF migrations, including deleted accounts while excluding the current user.
  • Expands tests for authentication, validation, and emails claimed after an earlier availability check or OTP request.
File Description
tests/​test_user.py Tests availability checks and conflict handling during email changes.
tests/​test_aaf.py Updates expected migration conflict messages.
services/​email_availability.py Introduces shared email availability and conflict checks.
schemas/​responses.py Defines the shared availability response schema.
routers/​utils.py Reuses the shared schema for registration availability checks.
routers/​user.py Adds the profile availability endpoint and adopts shared conflict checks.
routers/​aaf.py Reuses the shared conflict helper and aligns error messages.

Review effort: Balanced

@marius-mather marius-mather left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! thanks for the refactor

@minh-biocommons
minh-biocommons merged commit 08597ac into aaf-dev Nov 9, 2026
5 checks passed
@minh-biocommons
minh-biocommons deleted the aaf-change-email-tweak branch November 9, 2026 04:20
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.

3 participants