-
Notifications
You must be signed in to change notification settings - Fork 0
feat: profile update endpoints (including email change with OTP) #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements user profile update functionality, allowing users to update their email address (with OTP verification) and full name. The main features include a two-step email change flow with OTP verification, security measures like rate limiting, and a scheduled task to clean up expired OTPs.
- Added email update endpoints with OTP verification flow
- Added full name update endpoint
- Added password length validation change from 128 to 72 characters
- Added SQLite compatibility improvements to database migrations
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| routers/user.py | Added email update and full name update endpoints with OTP verification logic |
| db/models.py | Added EmailChangeOtp model and fixed Auth0Role flush instead of commit |
| schemas/biocommons.py | Added BiocommonsEmail, BiocommonsFullName validators and OldEmailRecord model; updated password max length |
| scheduled_tasks/tasks.py | Added cleanup_email_otps task and fixed Auth0Role.get_or_create_by_id null check |
| run_scheduler.py | Added cleanup job scheduling and table creation logic |
| migrations/versions/9f2d8c1b5d4e_add_email_change_otps.py | Created migration for email_change_otps table |
| migrations/versions/*.py | Added SQLite compatibility using batch mode and inspector checks |
| tests/test_user.py | Added tests for email and full name update flows |
| tests/test_router_user_utils.py | Added tests for OTP utility functions |
| tests/test_cleanup_otps.py | Added tests for OTP cleanup task |
| tests/schemas/test_biocommons_schemas.py | Added email validation tests and updated password length tests |
| tests/schemas/test_group_schema.py | Added Group schema validation tests |
| tests/test_sbp_register.py | Fixed test data to use dynamic allowed domain |
marius-mather
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all looks good to me!
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
0defda9 to
ca357c4
Compare
5eba435 to
c06c06a
Compare
marius-mather
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
Description
AAI-433: Allow Update of email on user profile page
AAI-475: Allow Update of full name on user profile page
Checklist
How to Test Manually
needs newest backend, then login as a user and change password/username/full name or email. ensure the values are updated in auth0
Screenshots for any UI changes
<img width="1678" height="1173" alt="Screenshot 2025-11-20 at 23 40 00" src="https://github.com/user-attachments/assets/fbe5dcfd-cc9


b-4920-98e2-9