File: UserPasswordExtraInvalidCredentialsProvider.inc

package info (click to toggle)
ldap-account-manager 9.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 84,712 kB
  • sloc: php: 226,230; javascript: 83,487; pascal: 41,693; perl: 414; sh: 273; xml: 228; makefile: 188
file content (37 lines) | stat: -rw-r--r-- 831 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

namespace LAM\PLUGINS\EXTRA_INVALID_CREDENTIALS;

/*

  This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
  Copyright (C) 2021 - 2024  Roland Gruber

*/

/**
 * Extra message for invalid credentials for PPolicy.
 *
 * @author Roland Gruber
 */
class UserPasswordExtraInvalidCredentialsProvider implements ExtraInvalidCredentialsProvider {

	/**
	 * @inheritDoc
	 */
	public function getAttributeNamesToRead(): array {
		return ['userpassword'];
	}

	/**
	 * @inheritDoc
	 */
	public function getExtraMessage(array $attributes, $ldap) {
		if (!empty($attributes['userpassword'][0]) && !pwd_is_enabled($attributes['userpassword'][0])) {
			logNewMessage(LOG_NOTICE, 'Account is locked by userPassword attribute: ' . $attributes['dn']);
			return _('Account is locked');
		}
		return null;
	}

}