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

Email address might be stored twice in database #11251

Closed
2 of 7 tasks
CirnoT opened this issue Apr 29, 2020 · 2 comments · Fixed by #15956
Closed
2 of 7 tasks

Email address might be stored twice in database #11251

CirnoT opened this issue Apr 29, 2020 · 2 comments · Fixed by #15956
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug

Comments

@CirnoT
Copy link
Contributor

CirnoT commented Apr 29, 2020

  • 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.

@CirnoT CirnoT changed the title Possible to add duplicate email on account Email address might be stored twice in database Apr 29, 2020
@stale
Copy link

stale bot commented Jun 28, 2020

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale stale bot added the issue/stale label Jun 28, 2020
@CirnoT
Copy link
Contributor Author

CirnoT commented Jun 28, 2020

Bad bot

@stale stale bot removed the issue/stale label Jun 28, 2020
@lunny lunny added type/bug issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented labels Jul 2, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Projects
None yet
2 participants