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

E-mail address change in LDAP creates separate address in gitea #28660

Closed
pboguslawski opened this issue Dec 30, 2023 · 1 comment · Fixed by #28733
Closed

E-mail address change in LDAP creates separate address in gitea #28660

pboguslawski opened this issue Dec 30, 2023 · 1 comment · Fixed by #28733
Assignees
Labels

Comments

@pboguslawski
Copy link
Contributor

Description

When gitea is syncing users from LDAP, changing user's e-mail address in LDAP and syncing users to gitea (cron task) creates extra e-mail address for this user in gitea db (email_address table) but should only change existing e-mail address like in LDAP.

As result, all old user e-mail addresses are remembered in gitea and if other user is assigned in LDAP e-mail address that was already assinged in the past in LDAP (and was freed), say test1@example.com, syncing such user from LDAP to gitea throws an error

2023/12/30 15:56:50 .../ldap/source_sync.go:134:Sync() [E] SyncExternalUsers[ldap]: Error creating user test: e-mail already in use [email: test1@example.com]

because such freed e-mail address is still in use on gitea's side by previous user.

Consider updating gitea user's primary e-mail address only from LDAP mail attribute without creating separate entry in email_address table.

Related: #18603

Gitea Version

1.21

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Compiled from sources.

Database

MySQL/MariaDB

@KN4CK3R KN4CK3R self-assigned this Jan 2, 2024
lunny pushed a commit that referenced this issue Feb 4, 2024
Fixes #28660
Fixes an admin api bug related to `user.LoginSource`
Fixed `/user/emails` response not identical to GitHub api

This PR unifies the user update methods. The goal is to keep the logic
only at one place (having audit logs in mind). For example, do the
password checks only in one method not everywhere a password is updated.

After that PR is merged, the user creation should be next.
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
Fixes go-gitea#28660
Fixes an admin api bug related to `user.LoginSource`
Fixed `/user/emails` response not identical to GitHub api

This PR unifies the user update methods. The goal is to keep the logic
only at one place (having audit logs in mind). For example, do the
password checks only in one method not everywhere a password is updated.

After that PR is merged, the user creation should be next.
Copy link

Automatically locked because of our CONTRIBUTING guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants