diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-02-24 14:13:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-24 14:13:59 +0800 |
commit | f1b1472632e36c3bb5df73f184a6efeef47f5d01 (patch) | |
tree | eace871525841fc31c07ec6fd3b194650a174359 /services/auth | |
parent | cb41f5cae16c5c11cad717c0d19333c2aa4e3b55 (diff) | |
download | gitea-f1b1472632e36c3bb5df73f184a6efeef47f5d01.tar.gz gitea-f1b1472632e36c3bb5df73f184a6efeef47f5d01.zip |
Fix ldap user sync missed email in email_address table (#18786)
* Fix ldap user sync missed email in email_address table
* Fix test
Diffstat (limited to 'services/auth')
-rw-r--r-- | services/auth/source/ldap/source_sync.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/services/auth/source/ldap/source_sync.go b/services/auth/source/ldap/source_sync.go index 74a62ce4e7..0d4d94a3ad 100644 --- a/services/auth/source/ldap/source_sync.go +++ b/services/auth/source/ldap/source_sync.go @@ -146,6 +146,7 @@ func (source *Source) Sync(ctx context.Context, updateExisting bool) error { log.Trace("SyncExternalUsers[%s]: Updating user %s", source.authSource.Name, usr.Name) usr.FullName = fullName + emailChanged := usr.Email != su.Mail usr.Email = su.Mail // Change existing admin flag only if AdminFilter option is set if len(source.AdminFilter) > 0 { @@ -157,7 +158,7 @@ func (source *Source) Sync(ctx context.Context, updateExisting bool) error { } usr.IsActive = true - err = user_model.UpdateUserCols(db.DefaultContext, usr, "full_name", "email", "is_admin", "is_restricted", "is_active") + err = user_model.UpdateUser(usr, emailChanged, "full_name", "email", "is_admin", "is_restricted", "is_active") if err != nil { log.Error("SyncExternalUsers[%s]: Error updating user %s: %v", source.authSource.Name, usr.Name, err) } |