Skip to content

Commit

Permalink
#4072: Improve comments on normalisation of email and username
Browse files Browse the repository at this point in the history
  • Loading branch information
mauromsl authored and ajrbyers committed Apr 23, 2024
1 parent 1811e7a commit 3b5aff5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,12 @@ def create_user(self, username=None, password=None, email=None, **kwargs):
raise ValueError(f'{email} not a valid email address.')

account = self.model(
# The original case of the email is preserved
# in the email field
email=email,
# Lowercasing the email into the username gets around duplicate
# accounts due to case-sensitivity. We still preserve the original
# casing for the email field and rely on username for CI constraint
# The email is lowercased in the username field
# so that we can perform case-insensitive checking
# and avoid creating duplicate accounts
username=email.lower(),
)

Expand Down

0 comments on commit 3b5aff5

Please sign in to comment.