diff --git a/src/Controllers/LDAPAuthController.php b/src/Controllers/LDAPAuthController.php index 8c25d7c..dc37861 100644 --- a/src/Controllers/LDAPAuthController.php +++ b/src/Controllers/LDAPAuthController.php @@ -75,11 +75,12 @@ public function handle(Request $request): ResponseInterface 'ldap', $user[strtolower($userLdapUsername)][0], function (Registration $registration) use ($user, $userLdapUsername, $userLdapMail) { - $registration - ->provide('username', $user[strtolower($userLdapUsername)][0]) - ->provideTrustedEmail($user[strtolower($userLdapMail)][0]) - //->provideAvatar($user->getJpegPhoto()) - ->setPayload((array)$user['dn']); + $registration->provide('username', $user[strtolower($userLdapUsername)][0]); + if ($user[strtolower($userLdapMail)]) { + $registration->provideTrustedEmail($user[strtolower($userLdapMail)][0]); + } + $registration->provideAvatar($user->getJpegPhoto()); + $registration->setPayload((array)$user['dn']); } ); } else {