Skip to content

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

Closed
@pboguslawski

Description

@pboguslawski

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions