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) {
+ $this->userAvatars->assignToUserFromUrl($user, $userDetails->picture);
+ }
+
if ($this->shouldSyncGroups()) {
$detachExisting = $this->config()['remove_from_groups'];
$this->groupService->syncUserWithFoundGroups($user, $userDetails->groups ?? [], $detachExisting);
$this->loginService->login($user, 'oidc');
- if ($this->config()['fetch_avatars'] && $userDetails->picture) {
- $this->userAvatars->assignToUserFromUrl($user, $userDetails->picture, $accessToken->getToken());
- }
-
return $user;
}