1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2026-01-03 23:42:28 +03:00

OIDC: Updated avatar fetching to run on each login

But only where the user does not already have an avatar assigned.
This aligns with the LDAP avatar fetching logic.
This commit is contained in:
Dan Brown
2025-05-24 16:34:36 +01:00
parent b64c9b31d5
commit 30bf0ce632
3 changed files with 32 additions and 6 deletions

View File

@@ -222,9 +222,7 @@ class OidcService
throw new OidcException($exception->getMessage());
}
// TODO - Update this (and tests and config option comments) to actually align with LDAP system
// which syncs whenever on login or registration, where there's no existing avatar.
if ($this->config()['fetch_avatar'] && $user->wasRecentlyCreated && $userDetails->picture) {
if ($this->config()['fetch_avatar'] && !$user->avatar()->exists() && $userDetails->picture) {
$this->userAvatars->assignToUserFromUrl($user, $userDetails->picture);
}