Closed
Description
- Gitea version (or commit ref): 1.12.0+dev-231-g1bf9e44bd
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No
- Not relevant
Description
It is possible to use 'Manage Email Addresses' to add an email that already exists, if the specified email is primary. Specifically, the isEmailUsed
in models/user_mail.go
only checks for duplicates in email_address
table, but we also store the email in user
table. This leads to an odd situation, where same email is present twice in database.
The same is possible if MakeEmailPrimary
is executed, as it does not remove previous entry from email_address
table.
We should most likely remove email from user
table and keep separate column for whether email is primary or not, in email_address
.
The above results in duplicate entries being presented in User Emails
part of Site Administration
.