mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
Fixes for #1128
This commit is contained in:
parent
35bfff878d
commit
d5a0ac8da8
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true;
|
||||
require_once '/var/lib/snappymail/index.php';
|
||||
|
||||
\SnappyMail\Repository::installPackage('plugin', 'change-password');
|
||||
\SnappyMail\Repository::installPackage('plugin', 'change-password-hestia');
|
||||
$sFile = APP_PRIVATE_DATA.'configs/plugin-change-password.json';
|
||||
if (!file_exists($sFile)) {
|
||||
file_put_contents('', json_encode([
|
||||
'plugin' => [
|
||||
'pass_min_length': 8,
|
||||
'pass_min_strength': 60,
|
||||
'driver_hestia_enabled': true,
|
||||
'driver_hestia_allowed_emails': '*',
|
||||
'hestia_host': gethostname(),
|
||||
'hestia_port': 8083 // $BACKEND_PORT
|
||||
]
|
||||
], JSON_PRETTY_PRINT));
|
||||
}
|
||||
// \SnappyMail\Repository::enablePackage('change-password');
|
||||
|
||||
\SnappyMail\Repository::installPackage('plugin', 'add-x-originating-ip-header');
|
||||
// \SnappyMail\Repository::enablePackage('add-x-originating-ip-header');
|
||||
|
||||
$sFile = APP_PRIVATE_DATA.'domains/hestia.json';
|
||||
if (!file_exists($sFile)) {
|
||||
$config = json_decode(file_get_contents(__DIR__ . '/app/domains/default.json'), true);
|
||||
$config['IMAP']['shortLogin'] = true;
|
||||
$config['SMTP']['shortLogin'] = true;
|
||||
file_put_contents($sFile, json_encode($config, JSON_PRETTY_PRINT));
|
||||
}
|
60
integrations/hestiacp/install/deb/snappymail/install.php
Normal file
60
integrations/hestiacp/install/deb/snappymail/install.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true;
|
||||
require_once '/var/lib/snappymail/index.php';
|
||||
|
||||
$oConfig = \RainLoop\Api::Config();
|
||||
|
||||
// Change default login data / key
|
||||
$oConfig->Set('security', 'admin_login', $argv[1]);
|
||||
$oConfig->Set('security', 'admin_panel_key', $argv[1]);
|
||||
$oConfig->SetPassword($argv[2]);
|
||||
|
||||
// Allow Contacts to be saved in database
|
||||
$oConfig->Set('contacts', 'enable', 'On');
|
||||
$oConfig->Set('contacts', 'allow_sync', 'On');
|
||||
$oConfig->Set('contacts', 'type', 'mysql');
|
||||
$oConfig->Set('contacts', 'pdo_dsn', 'mysql:host=127.0.0.1;port=3306;dbname=snappymail');
|
||||
$oConfig->Set('contacts', 'pdo_user', 'snappymail');
|
||||
$oConfig->Set('contacts', 'pdo_password', $argv[3]);
|
||||
|
||||
// Plugins
|
||||
$oConfig->Set('plugins', 'enable', 'On');
|
||||
|
||||
\SnappyMail\Repository::installPackage('plugin', 'change-password');
|
||||
\SnappyMail\Repository::installPackage('plugin', 'change-password-hestia');
|
||||
$sFile = APP_PRIVATE_DATA.'configs/plugin-change-password.json';
|
||||
if (!file_exists($sFile)) {
|
||||
file_put_contents('', json_encode([
|
||||
'plugin' => [
|
||||
'pass_min_length' => 8,
|
||||
'pass_min_strength' => 60,
|
||||
'driver_hestia_enabled' => true,
|
||||
'driver_hestia_allowed_emails' => '*',
|
||||
'hestia_host' => gethostname(),
|
||||
'hestia_port' => 8083 // $BACKEND_PORT
|
||||
]
|
||||
], JSON_PRETTY_PRINT));
|
||||
}
|
||||
\SnappyMail\Repository::enablePackage('change-password');
|
||||
|
||||
\SnappyMail\Repository::installPackage('plugin', 'add-x-originating-ip-header');
|
||||
\SnappyMail\Repository::enablePackage('add-x-originating-ip-header');
|
||||
$sFile = APP_PRIVATE_DATA.'configs/plugin-add-x-originating-ip-header.json';
|
||||
if (!file_exists($sFile)) {
|
||||
file_put_contents('', json_encode([
|
||||
'plugin' => [
|
||||
'check_proxy' => true
|
||||
]
|
||||
], JSON_PRETTY_PRINT));
|
||||
}
|
||||
|
||||
$oConfig->Save();
|
||||
|
||||
$sFile = APP_PRIVATE_DATA.'domains/hestia.json';
|
||||
if (!file_exists($sFile)) {
|
||||
$config = json_decode(file_get_contents(__DIR__ . '/app/domains/default.json'), true);
|
||||
$config['IMAP']['shortLogin'] = true;
|
||||
$config['SMTP']['shortLogin'] = true;
|
||||
file_put_contents($sFile, json_encode($config, JSON_PRETTY_PRINT));
|
||||
}
|
|
@ -45,6 +45,8 @@ class ChangePasswordHestiaDriver
|
|||
return false;
|
||||
}
|
||||
|
||||
$this->oLogger->Write("Hestia: Try to change password for {$oAccount->Email()}");
|
||||
|
||||
$sHost = $this->oConfig->Get('plugin', 'hestia_login');
|
||||
$sPort = $this->oConfig->Get('plugin', 'hestia_port');
|
||||
|
||||
|
@ -54,7 +56,15 @@ class ChangePasswordHestiaDriver
|
|||
'password' => $sPrevPassword,
|
||||
'new' => $sNewPassword,
|
||||
);
|
||||
$cRequest = $HTTP->doRequest('POST','https://'.$sHost.':'.$sPort.'/reset/mail/',http_build_query($postvars));
|
||||
return '==ok==' == $cRequest->body;
|
||||
$response = $HTTP->doRequest('POST', 'https://'.$sHost.':'.$sPort.'/reset/mail/', \http_build_query($postvars));
|
||||
if (!$response) {
|
||||
$this->oLogger->Write("Hestia[Error]: Response failed");
|
||||
return false;
|
||||
}
|
||||
if ('==ok==' != $response->body) {
|
||||
$this->oLogger->Write("Hestia[Error]: Response: {$response->status} {$response->body}");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ trait Messages
|
|||
$oParams->bHideDeleted = !empty($oSettingsLocal->GetConf('HideDeleted', 1));
|
||||
}
|
||||
|
||||
// \ignore_user_abort(true);
|
||||
$oMessageList = $this->MailClient()->MessageList($oParams);
|
||||
if ($sHash) {
|
||||
$this->cacheByKey($sHash);
|
||||
|
|
Loading…
Reference in a new issue