Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit a126670

Browse files
committed
Fixed saving thumbnail photo
- Closes #28
1 parent cfb2c59 commit a126670

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/AdldapAuthUserProvider.php

+12-6
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,18 @@ protected function syncModelFromAdldap(User $user, Authenticatable $model)
142142
$attributes = $this->getSyncAttributes();
143143

144144
foreach ($attributes as $modelField => $adField) {
145-
$adValue = $user->{$adField};
146-
147-
if (is_array($adValue)) {
148-
// If the AD Value is an array, we'll
149-
// retrieve the first value.
150-
$adValue = Arr::get($adValue, 0);
145+
if ($adField === ActiveDirectory::THUMBNAIL) {
146+
// If the field we're retrieving is the users thumbnail photo, we need
147+
// to retrieve it encoded so we're able to save it to the database.
148+
$adValue = $user->getThumbnailEncoded();
149+
} else {
150+
$adValue = $user->{$adField};
151+
152+
if (is_array($adValue)) {
153+
// If the AD Value is an array, we'll
154+
// retrieve the first value.
155+
$adValue = Arr::get($adValue, 0);
156+
}
151157
}
152158

153159
$model->{$modelField} = $adValue;

0 commit comments

Comments
 (0)