Skip to content

Commit 2e073d5

Browse files
author
Gaetano Giunta
committed
Better erro messages when a user has an empty email from ldap
1 parent 4b0c0f4 commit 2e073d5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Adapter/LDAP/RemoteUser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ public function getRoles()
4141
}
4242

4343
/**
44-
* @todo throw if unset ?
4544
* @return string
4645
*/
4746
public function getEmail()
4847
{
48+
if (!isset($this->profile[$this->emailField])) {
49+
throw new \RuntimeException("User account misses or has empty email (from ldap profile field '{$this->emailField}')");
50+
}
4951
return $this->profile[$this->emailField];
5052
}
5153

Security/User/Provider/RemoteUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function loadAPIUserByRemoteUser(KaliopRemoteUser $remoteUser)
108108
}
109109

110110
} catch (\Exception $e) {
111-
if ($this->logger) $this->logger->error("Unexpected error while finding/creating/updating repo user from data gotten from remote service");
111+
if ($this->logger) $this->logger->error("Unexpected error while finding/creating/updating repo user from data gotten from remote service: " . $e->getMessage());
112112
throw $e;
113113
}
114114

0 commit comments

Comments
 (0)