Skip to content

Commit 7312b28

Browse files
committed
Added: Plugin: Contacts suggestion from ldap
Added: Custom favicon setting + Small fixes
1 parent d6d19c9 commit 7312b28

File tree

25 files changed

+526
-25
lines changed

25 files changed

+526
-25
lines changed

build/plugin.xml

+10
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@
7878
<param name="plugin-name" value="hmailserver-change-password"/>
7979
</antcall>
8080
</target>
81+
<target name="ldap-change-password">
82+
<antcall target="_build_plugin_">
83+
<param name="plugin-name" value="ldap-change-password"/>
84+
</antcall>
85+
</target>
86+
<target name="ldap-contacts-suggestions">
87+
<antcall target="_build_plugin_">
88+
<param name="plugin-name" value="ldap-contacts-suggestions"/>
89+
</antcall>
90+
</target>
8191
<target name="snowfall-on-login-screen">
8292
<antcall target="_build_plugin_">
8393
<param name="plugin-name" value="snowfall-on-login-screen"/>

dev/Settings/Admin/Branding.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
this.loadingDesc = ko.observable(Settings.settingsGet('LoadingDescription'));
3131
this.loadingDesc.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
3232

33+
this.faviconUrl = ko.observable(Settings.settingsGet('FaviconUrl'));
34+
this.faviconUrl.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
35+
3336
this.loginLogo = ko.observable(Settings.settingsGet('LoginLogo') || '');
3437
this.loginLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
3538

@@ -88,7 +91,8 @@
8891

8992
var
9093
f1 = Utils.settingsSaveHelperSimpleFunction(self.title.trigger, self),
91-
f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self)
94+
f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self),
95+
f3 = Utils.settingsSaveHelperSimpleFunction(self.faviconUrl.trigger, self)
9296
;
9397

9498
self.title.subscribe(function (sValue) {
@@ -103,6 +107,12 @@
103107
});
104108
});
105109

110+
self.faviconUrl.subscribe(function (sValue) {
111+
Remote.saveAdminConfig(f3, {
112+
'FaviconUrl': Utils.trim(sValue)
113+
});
114+
});
115+
106116
}, 50);
107117
};
108118

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "RainLoop",
33
"title": "RainLoop Webmail",
44
"version": "1.9.2",
5-
"release": "357",
5+
"release": "361",
66
"description": "Simple, modern & fast web-based email client",
77
"homepage": "http://rainloop.net",
88
"main": "gulpfile.js",
@@ -40,7 +40,7 @@
4040
"plugins"
4141
],
4242
"readmeFilename": "README.md",
43-
"ownCloudPackageVersion": "4.6",
43+
"ownCloudPackageVersion": "4.7",
4444
"engines": {
4545
"node": ">= 0.10.0"
4646
},
@@ -49,7 +49,7 @@
4949
"rimraf": "*",
5050
"jshint-summary": "*",
5151
"webpack": "*",
52-
"gulp": "*",
52+
"gulp": "~3.9.0",
5353
"gulp-util": "*",
5454
"gulp-uglify": "*",
5555
"gulp-rimraf": "*",

plugins/ldap-change-password/ChangePasswordLdapDriver.php

+21-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ class ChangePasswordLdapDriver implements \RainLoop\Providers\ChangePassword\Cha
77
*/
88
private $sHostName = '127.0.0.1';
99

10+
/**
11+
* @var int
12+
*/
13+
private $iHostPort = 389;
14+
1015
/**
1116
* @var string
1217
*/
@@ -34,15 +39,17 @@ class ChangePasswordLdapDriver implements \RainLoop\Providers\ChangePassword\Cha
3439

3540
/**
3641
* @param string $sHostName
42+
* @param int $iHostPort
3743
* @param string $sUserDnFormat
3844
* @param string $sPasswordField
3945
* @param string $sPasswordEncType
4046
*
4147
* @return \ChangePasswordLdapDriver
4248
*/
43-
public function SetConfig($sHostName, $sUserDnFormat, $sPasswordField, $sPasswordEncType)
49+
public function SetConfig($sHostName, $iHostPort, $sUserDnFormat, $sPasswordField, $sPasswordEncType)
4450
{
4551
$this->sHostName = $sHostName;
52+
$this->iHostPort = $iHostPort;
4653
$this->sUserDnFormat = $sUserDnFormat;
4754
$this->sPasswordField = $sPasswordField;
4855
$this->sPasswordEncType = $sPasswordEncType;
@@ -114,7 +121,7 @@ public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNe
114121
'{imap:port}' => $oAccount->DomainIncPort()
115122
));
116123

117-
$oCon = @\ldap_connect($this->sHostName);
124+
$oCon = @\ldap_connect($this->sHostName, $this->iHostPort);
118125
if ($oCon)
119126
{
120127
@\ldap_set_option($oCon, LDAP_OPT_PROTOCOL_VERSION, 3);
@@ -133,22 +140,31 @@ public function ChangePassword(\RainLoop\Account $oAccount, $sPrevPassword, $sNe
133140
return false;
134141
}
135142
}
143+
else
144+
{
145+
return false;
146+
}
136147

148+
$sSshaSalt = '';
149+
$sShaPrefix = '{SHA}';
137150
$sEncodedNewPassword = $sNewPassword;
138151
switch (\strtolower($this->sPasswordEncType))
139152
{
153+
case 'ssha':
154+
$sSshaSalt = $this->getSalt(4);
155+
$sShaPrefix = '{SSHA}';
140156
case 'sha':
141157
switch (true)
142158
{
143159
default:
144160
case \function_exists('sha1'):
145-
$sEncodedNewPassword = '{SHA}'.\base64_encode(\pack('H*', \sha1($sNewPassword)));
161+
$sEncodedNewPassword = $sShaPrefix.\base64_encode(\sha1($sNewPassword.$sSshaSalt, true).$sSshaSalt);
146162
break;
147163
case \function_exists('hash'):
148-
$sEncodedNewPassword = '{SHA}'.\base64_encode(\hash('sha1', $sNewPassword, true));
164+
$sEncodedNewPassword = $sShaPrefix.\base64_encode(\hash('sha1', $sNewPassword, true).$sSshaSalt);
149165
break;
150166
case \function_exists('mhash') && defined('MHASH_SHA1'):
151-
$sEncodedNewPassword = '{SHA}'.\base64_encode(\mhash(MHASH_SHA1, $sNewPassword));
167+
$sEncodedNewPassword = $sShaPrefix.\base64_encode(\mhash(MHASH_SHA1, $sNewPassword).$sSshaSalt);
152168
break;
153169
}
154170
break;

plugins/ldap-change-password/VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0
1+
1.1

plugins/ldap-change-password/index.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,19 @@ public function MainFabrica($sName, &$oProvider)
3131
case 'change-password':
3232

3333
$sHostName = \trim($this->Config()->Get('plugin', 'hostname', ''));
34+
$iHostPort = (int) $this->Config()->Get('plugin', 'port', 389);
3435
$sUserDnFormat = \trim($this->Config()->Get('plugin', 'user_dn_format', ''));
3536
$sPasswordField = \trim($this->Config()->Get('plugin', 'password_field', ''));
3637
$sPasswordEncType = \trim($this->Config()->Get('plugin', 'password_enc_type', ''));
3738

38-
if (!empty($sHostName) && !empty($sUserDnFormat) && !empty($sPasswordField) && !empty($sPasswordEncType))
39+
if (!empty($sHostName) && 0 < $iHostPort && !empty($sUserDnFormat) && !empty($sPasswordField) && !empty($sPasswordEncType))
3940
{
4041
include_once __DIR__.'/ChangePasswordLdapDriver.php';
4142

4243
$oProvider = new \ChangePasswordLdapDriver();
4344

4445
$oProvider
45-
->SetConfig($sHostName, $sUserDnFormat, $sPasswordField, $sPasswordEncType)
46+
->SetConfig($sHostName, $iHostPort, $sUserDnFormat, $sPasswordField, $sPasswordEncType)
4647
->SetAllowedEmails(\strtolower(\trim($this->Config()->Get('plugin', 'allowed_emails', ''))))
4748
->SetLogger($this->Manager()->Actions()->Logger())
4849
;
@@ -59,14 +60,17 @@ public function configMapping()
5960
return array(
6061
\RainLoop\Plugins\Property::NewInstance('hostname')->SetLabel('LDAP hostname')
6162
->SetDefaultValue('127.0.0.1'),
63+
\RainLoop\Plugins\Property::NewInstance('port')->SetLabel('LDAP port')
64+
->SetType(\RainLoop\Enumerations\PluginPropertyType::INT)
65+
->SetDefaultValue(389),
6266
\RainLoop\Plugins\Property::NewInstance('user_dn_format')->SetLabel('User DN format')
6367
->SetDescription('LDAP user dn format. Supported tokens: {email}, {login}, {domain}, {domain:dc}, {imap:login}, {imap:host}, {imap:port}')
6468
->SetDefaultValue('uid={imap:login},ou=Users,{domain:dc}'),
6569
\RainLoop\Plugins\Property::NewInstance('password_field')->SetLabel('Password field')
6670
->SetDefaultValue('userPassword'),
6771
\RainLoop\Plugins\Property::NewInstance('password_enc_type')->SetLabel('Encryption type')
6872
->SetType(\RainLoop\Enumerations\PluginPropertyType::SELECTION)
69-
->SetDefaultValue(array('SHA', 'MD5', 'Crypt', 'Clear')),
73+
->SetDefaultValue(array('SHA', 'SSHA', 'MD5', 'Crypt', 'Clear')),
7074
\RainLoop\Plugins\Property::NewInstance('allowed_emails')->SetLabel('Allowed emails')
7175
->SetDescription('Allowed emails, space as delimiter, wildcard supported. Example: user1@domain1.net user2@domain1.net *@domain2.net')
7276
->SetDefaultValue('*')
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 RainLoop Team
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)