Skip to content
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

Request User Emails for Certain Site Features #186

Merged
merged 11 commits into from
May 7, 2024

Conversation

bencap
Copy link
Collaborator

@bencap bencap commented Apr 23, 2024

Adds a new validator on the CurrentUserUpdate view model that validates email addresses are the correct syntax and deliverable. This was done with a new dependency: https://pypi.org/project/email-validator/

Adds a new dependency require_current_user_with_email. Essentially the same as require_current_user, but returns a 400 status code if the user has an unset email address associated with their user record.

async def require_current_user_with_email(user: User = Depends(require_current_user)) -> User:
if user.email is None:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
Copy link
Contributor

Choose a reason for hiding this comment

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

wait, is this 400 here and 403 below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I originally made it 403 but then I started second guessing and thought 400 would make more sense. I'll make sure the response codes are consistent before I open it.

@bencap bencap force-pushed the feature/bencap/21/request-user-emails branch from d3c715b to 6c1ae2b Compare April 24, 2024 00:13
@bencap bencap force-pushed the feature/bencap/21/request-user-emails branch 2 times, most recently from 9639603 to a8cc7f8 Compare April 29, 2024 22:34
@bencap bencap changed the base branch from jstone-uw/better-orcid-auth to feature/bencap/76/improved-admin-user-handling April 29, 2024 22:34
@bencap bencap marked this pull request as ready for review April 29, 2024 23:19
@bencap bencap requested review from ashsny and jstone-dev April 29, 2024 23:19
@bencap bencap force-pushed the feature/bencap/76/improved-admin-user-handling branch from b4402ab to 248dbd3 Compare April 30, 2024 17:55
@bencap bencap force-pushed the feature/bencap/21/request-user-emails branch 2 times, most recently from 705cbee to 0730a98 Compare April 30, 2024 18:05
@bencap bencap force-pushed the feature/bencap/76/improved-admin-user-handling branch 2 times, most recently from 2ff1a5c to 52f2d33 Compare April 30, 2024 18:16
@bencap bencap force-pushed the feature/bencap/21/request-user-emails branch from 0730a98 to 7901a58 Compare April 30, 2024 18:21
@bencap bencap force-pushed the feature/bencap/21/request-user-emails branch from 7901a58 to 8b84568 Compare April 30, 2024 18:23
src/mavedb/lib/authorization.py Outdated Show resolved Hide resolved
tests/routers/test_experiments.py Outdated Show resolved Hide resolved
tests/routers/test_score_set.py Outdated Show resolved Hide resolved
tests/routers/test_score_set.py Outdated Show resolved Hide resolved
Base automatically changed from feature/bencap/76/improved-admin-user-handling to release-2024.1.0 May 3, 2024 00:02
@ashsny ashsny merged commit 909e402 into release-2024.1.0 May 7, 2024
4 checks passed
@ashsny ashsny deleted the feature/bencap/21/request-user-emails branch May 7, 2024 05:08
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