-
Notifications
You must be signed in to change notification settings - Fork 2
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
Request User Emails for Certain Site Features #186
Conversation
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, |
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.
wait, is this 400 here and 403 below?
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.
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.
d3c715b
to
6c1ae2b
Compare
9639603
to
a8cc7f8
Compare
b4402ab
to
248dbd3
Compare
705cbee
to
0730a98
Compare
2ff1a5c
to
52f2d33
Compare
0730a98
to
7901a58
Compare
7901a58
to
8b84568
Compare
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 asrequire_current_user
, but returns a 400 status code if the user has an unset email address associated with their user record.