gitea/services/auth
Râu Cao f48c0135a6
Fix/improve avatar sync from LDAP (#34573)
This fixes 3 issues I encountered when debugging problems with our LDAP sync:

1. The comparison of the hashed image data in `IsUploadAvatarChanged` is
wrong. It seems to be from before avatar hashing was changed and unified
in #22289. This results in the function always returning `true` for any
avatars, even if they weren't changed.
2. Even if there's no avatar to upload (i.e. no avatar available for the
LDAP entry), the upload function would still be called for every single
user, only to then fail, because the data isn't valid. This is
unnecessary.
3. Another small issue is that the comparison function (and thus hashing
of data) is called for every user, even if there is no avatar attribute
configured at all for the LDAP source. Thus, I switched the condition
nesting, so that no cycles are wasted when avatar sync isn't configured
in the first place.

I also added a trace log for when there is actually a new avatar being
uploaded for an existing user, which is now only shown when that is
actually the case.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-06-02 10:05:47 -07:00
..
source Fix/improve avatar sync from LDAP (#34573) 2025-06-02 10:05:47 -07:00
auth.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
auth_test.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
auth_token.go Enhanced auth token / remember me (#27606) 2023-10-14 00:56:41 +00:00
auth_token_test.go Refactor timeutil package (#28623) 2023-12-28 10:09:57 +00:00
basic.go Enforce two-factor auth (2FA: TOTP or WebAuthn) (#34187) 2025-04-28 15:31:59 -07:00
group.go Remove `Named` interface (#26913) 2023-09-05 15:58:30 +00:00
httpsign.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
interface.go Enforce two-factor auth (2FA: TOTP or WebAuthn) (#34187) 2025-04-28 15:31:59 -07:00
main_test.go Enhanced auth token / remember me (#27606) 2023-10-14 00:56:41 +00:00
oauth2.go Refactor context flash msg and global variables (#33375) 2025-01-25 14:36:47 +00:00
oauth2_test.go Fix some migration and repo name problems (#33986) 2025-03-24 20:26:58 -07:00
reverseproxy.go Refactor context flash msg and global variables (#33375) 2025-01-25 14:36:47 +00:00
session.go Fix the bug that user may logout if he switch pages too fast (#29962) 2024-03-21 08:48:08 +00:00
signin.go remove util.OptionalBool and related functions (#29513) 2024-03-02 16:42:31 +01:00
source.go Final round of `db.DefaultContext` refactor (#27587) 2023-10-14 08:37:24 +00:00
sspi.go Fix context usage (#33554) 2025-02-11 16:46:03 +08:00
sspiauth_posix.go Make SSPI auth mockable (#27036) 2023-09-17 23:32:56 +00:00
sspiauth_windows.go Make SSPI auth mockable (#27036) 2023-09-17 23:32:56 +00:00
sync.go Use db.Find instead of writing methods for every object (#28084) 2023-11-24 03:49:41 +00:00