Skip to content

Conversation

@codingjoe
Copy link
Owner

No description provided.

@codecov
Copy link

codecov bot commented Aug 16, 2019

Codecov Report

Merging #5 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master     #5   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     13    +1     
  Lines         201    223   +22     
=====================================
+ Hits          201    223   +22
Impacted Files Coverage Δ
mailauth/forms.py 100% <100%> (ø) ⬆️
mailauth/contrib/user/models.py 100% <100%> (ø) ⬆️
...th/contrib/user/migrations/0003_ci_unique_index.py 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 06ffebf...626cda6. Read the comment docs.

@SebastianKapunkt
Copy link
Collaborator

SebastianKapunkt commented Aug 16, 2019

An option to not to create an extra index would be to always store the emails in lowercase and convert requests to lowercase before search.

@codingjoe codingjoe force-pushed the email-caseinsensitive branch 2 times, most recently from 446276b to b91d282 Compare August 19, 2019 09:55
@codingjoe
Copy link
Owner Author

@SebastianKapunkt very good point. Both methods may yield somewhat unexpected results. If one stores only lower case values, you are essentially overwriting the user input. That is ok though, I would do the same with phone numbers. What I don't like is that this method does not prevent wrong email addresses on a database level. The Index that I am adding has a unique constraint. It prevents you from adding duplicate email addresses on database level.

I believe the cleanest way in PostgreSQL is to use the CIEmailField. I will create a patch that does supports the optimal solution for all DB backends, even it requires a little more code on our side.

@codingjoe codingjoe force-pushed the email-caseinsensitive branch from b91d282 to 2cbe338 Compare August 19, 2019 10:09
Copy link
Collaborator

@SebastianKapunkt SebastianKapunkt left a comment

Choose a reason for hiding this comment

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

Good to go. Tested it manually in a new project.

@codingjoe codingjoe merged commit 1932809 into master Aug 26, 2019
@codingjoe codingjoe deleted the email-caseinsensitive branch September 23, 2025 11:03
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