| 1 |
<?php |
| 2 |
|
| 3 |
namespace LAM\PLUGINS\EXTRA_INVALID_CREDENTIALS; |
| 4 |
|
| 5 |
/* |
| 6 |
|
| 7 |
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) |
| 8 |
Copyright (C) 2021 - 2024 Roland Gruber |
| 9 |
|
| 10 |
*/ |
| 11 |
|
| 12 |
/** |
| 13 |
* Extra message for invalid credentials for PPolicy. |
| 14 |
* |
| 15 |
* @author Roland Gruber |
| 16 |
*/ |
| 17 |
class UserPasswordExtraInvalidCredentialsProvider implements ExtraInvalidCredentialsProvider { |
| 18 |
|
| 19 |
/** |
| 20 |
* @inheritDoc |
| 21 |
*/ |
| 22 |
public function getAttributeNamesToRead(): array { |
| 23 |
return ['userpassword']; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* @inheritDoc |
| 28 |
*/ |
| 29 |
public function getExtraMessage(array $attributes, $ldap) { |
| 30 |
if (!empty($attributes['userpassword'][0]) && !pwd_is_enabled($attributes['userpassword'][0])) { |
| 31 |
logNewMessage(LOG_NOTICE, 'Account is locked by userPassword attribute: ' . $attributes['dn']); |
| 32 |
return _('Account is locked'); |
| 33 |
} |
| 34 |
return null; |
| 35 |
} |
| 36 |
|
| 37 |
} |