diff --git a/app/api/module/Auth/src/Adapter/LdapAdapter.php b/app/api/module/Auth/src/Adapter/LdapAdapter.php index 24588645a9..d134dafc70 100644 --- a/app/api/module/Auth/src/Adapter/LdapAdapter.php +++ b/app/api/module/Auth/src/Adapter/LdapAdapter.php @@ -92,7 +92,10 @@ public function resetPassword(string $identifier, string $newPassword): bool */ public function register(string $identifier, string $password, string $email, array $attributes = []): void { - $attributes = array_merge(['email' => $email], $attributes); + // The `sn` attribute is required while using the object class `inetOrgPerson`. + // This is a local authentication adapter so the data in the `sn` field isn't important. + $attributes['sn'] = $identifier; + $this->client->register($identifier, $password, $attributes); } diff --git a/app/api/module/Auth/src/Adapter/LdapAdapterFactory.php b/app/api/module/Auth/src/Adapter/LdapAdapterFactory.php index 2d3b059b83..4b3407b8a4 100644 --- a/app/api/module/Auth/src/Adapter/LdapAdapterFactory.php +++ b/app/api/module/Auth/src/Adapter/LdapAdapterFactory.php @@ -12,8 +12,14 @@ class LdapAdapterFactory implements FactoryInterface { public function __invoke(ContainerInterface $container, $requestedName, array $options = null): LdapAdapter { + /** + * @var Client $client + */ $client = $container->get(Client::class); + // Using an object class without a `userAccountControl` attribute. + $client->setUserAccountControlAttribute(null); + return new LdapAdapter($client); } }