mirror of
https://github.com/healthchecks/healthchecks.git
synced 2026-04-25 06:55:53 +03:00
[GH-ISSUE #290] Account's email uniqueness not enforced by database #219
Labels
No labels
bug
bug
bug
feature
good-first-issue
new integration
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/healthchecks#219
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cuu508 on GitHub (Sep 30, 2019).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/290
There's a race condition when creating an user account. It is possible to create two user accounts with the same email address, which causes various problems later.
Either the email column needs a uniqueness constraint, or or the username (which already has uniqueness contraint) needs to be generated from email in a deterministic way.
@cuu508 commented on GitHub (Oct 12, 2019):
I had fixed this by deriving username from email (and the username already has an uniqueness constraint, so problem solved...?)
Problem with this is that users can change their email addresses. Consider:
@cuu508 commented on GitHub (Oct 12, 2019):
Adding an explicit uniqueness constraint to the email column seems like the cleaner solution. I'm not sure if there is an idiomatic way to do that in Django for the default User model. For time being, on the hosted service, I've just manually added a constraint in the database:
@immanuelfodor commented on GitHub (Jan 3, 2020):
FYI, you can't add a unique constraint in SQLite, but can create a unique index for the same effect: https://stackoverflow.com/a/15498225
Added this manually after https://github.com/healthchecks/healthchecks/issues/306#issuecomment-570526115