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

Coerce emails to lower #267

Closed
signebedi opened this issue Jun 18, 2024 · 3 comments
Closed

Coerce emails to lower #267

signebedi opened this issue Jun 18, 2024 · 3 comments

Comments

@signebedi
Copy link
Owner

Like usernames, we should coerce all emails to lowercase.

Originally posted by @signebedi in #239 (comment)

@signebedi
Copy link
Owner Author

The point is, emails are not case sensitive, so we should coerce them into lower to prevent situations where the same email is reused with a certain degree of capitalization changes. We use the ilike operator from sqlalchemy, which in theory should handle this at the point of user creation, but I think that it is still worth implementing.

@signebedi
Copy link
Owner Author

This change, when pushed, will likely invalidate several API keys, which store user emails as their foreign key...

@signebedi
Copy link
Owner Author

Could this maybe have been done more efficiently using a validator in the pydantic model? SOmething like:

@validator('username', 'email')
def to_lower(cls, value):
     return value.lower()

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

No branches or pull requests

1 participant