Skip to content

Inconsistent e-mail address sync from LDAP #18603

Closed
@pboguslawski

Description

@pboguslawski

Gitea Version

1.16-rc1

Git Version

No response

Operating System

No response

How are you running Gitea?

Compiled from source.

Database

No response

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

According to

#4497 (comment)

LDAP sync cron task synchronizes only primary user mail; current sync code

https://github.com/go-gitea/gitea/blob/main/services/auth/source/ldap/source_sync.go#L157

updates only email column in user table and does not update extra e-mails nor is_primary state in this table.

There should be separate new method called there for consistent updating user primary e-mail (i.e. in users table and extra emails table with is_primary updating). LDAP should not add changed e-mail as new e-mail (like manual changing user email in admin panel does after #17549) but should update current primary e-mail only like it was working in gitea 1.13.

Same solution should be applied to LDAP sync code on user login if #18452 (comment) is merged.

To be considered: separate storing user primary e-mail in two separate tables is error prone. It should be kept in only one place problably to avoid such bugs.

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions