@@ -31,18 +31,19 @@ public function MainFabrica($sName, &$oProvider)
31
31
case 'change-password ' :
32
32
33
33
$ sHostName = \trim ($ this ->Config ()->Get ('plugin ' , 'hostname ' , '' ));
34
+ $ iHostPort = (int ) $ this ->Config ()->Get ('plugin ' , 'port ' , 389 );
34
35
$ sUserDnFormat = \trim ($ this ->Config ()->Get ('plugin ' , 'user_dn_format ' , '' ));
35
36
$ sPasswordField = \trim ($ this ->Config ()->Get ('plugin ' , 'password_field ' , '' ));
36
37
$ sPasswordEncType = \trim ($ this ->Config ()->Get ('plugin ' , 'password_enc_type ' , '' ));
37
38
38
- if (!empty ($ sHostName ) && !empty ($ sUserDnFormat ) && !empty ($ sPasswordField ) && !empty ($ sPasswordEncType ))
39
+ if (!empty ($ sHostName ) && 0 < $ iHostPort && !empty ($ sUserDnFormat ) && !empty ($ sPasswordField ) && !empty ($ sPasswordEncType ))
39
40
{
40
41
include_once __DIR__ .'/ChangePasswordLdapDriver.php ' ;
41
42
42
43
$ oProvider = new \ChangePasswordLdapDriver ();
43
44
44
45
$ oProvider
45
- ->SetConfig ($ sHostName , $ sUserDnFormat , $ sPasswordField , $ sPasswordEncType )
46
+ ->SetConfig ($ sHostName , $ iHostPort , $ sUserDnFormat , $ sPasswordField , $ sPasswordEncType )
46
47
->SetAllowedEmails (\strtolower (\trim ($ this ->Config ()->Get ('plugin ' , 'allowed_emails ' , '' ))))
47
48
->SetLogger ($ this ->Manager ()->Actions ()->Logger ())
48
49
;
@@ -59,14 +60,17 @@ public function configMapping()
59
60
return array (
60
61
\RainLoop \Plugins \Property::NewInstance ('hostname ' )->SetLabel ('LDAP hostname ' )
61
62
->SetDefaultValue ('127.0.0.1 ' ),
63
+ \RainLoop \Plugins \Property::NewInstance ('port ' )->SetLabel ('LDAP port ' )
64
+ ->SetType (\RainLoop \Enumerations \PluginPropertyType::INT )
65
+ ->SetDefaultValue (389 ),
62
66
\RainLoop \Plugins \Property::NewInstance ('user_dn_format ' )->SetLabel ('User DN format ' )
63
67
->SetDescription ('LDAP user dn format. Supported tokens: {email}, {login}, {domain}, {domain:dc}, {imap:login}, {imap:host}, {imap:port} ' )
64
68
->SetDefaultValue ('uid={imap:login},ou=Users,{domain:dc} ' ),
65
69
\RainLoop \Plugins \Property::NewInstance ('password_field ' )->SetLabel ('Password field ' )
66
70
->SetDefaultValue ('userPassword ' ),
67
71
\RainLoop \Plugins \Property::NewInstance ('password_enc_type ' )->SetLabel ('Encryption type ' )
68
72
->SetType (\RainLoop \Enumerations \PluginPropertyType::SELECTION )
69
- ->SetDefaultValue (array ('SHA ' , 'MD5 ' , 'Crypt ' , 'Clear ' )),
73
+ ->SetDefaultValue (array ('SHA ' , 'SSHA ' , ' MD5 ' , 'Crypt ' , 'Clear ' )),
70
74
\RainLoop \Plugins \Property::NewInstance ('allowed_emails ' )->SetLabel ('Allowed emails ' )
71
75
->SetDescription ('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net ' )
72
76
->SetDefaultValue ('* ' )
0 commit comments