mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-31 03:52:01 +08:00
Nextcloud password generator got lost. Put it back
This commit is contained in:
parent
a197378b7c
commit
e183764e51
2 changed files with 11 additions and 1 deletions
|
@ -42,7 +42,7 @@ class AdminSettings implements ISettings
|
|||
}
|
||||
$parameters['snappymail-admin-password'] = $sPassword;
|
||||
|
||||
$parameters['can-import-rainloop'] = \is_dir(
|
||||
$parameters['can-import-rainloop'] = $sPassword && \is_dir(
|
||||
\rtrim(\trim(\OC::$server->getSystemConfig()->getValue('datadirectory', '')), '\\/')
|
||||
. '/rainloop-storage'
|
||||
);
|
||||
|
|
|
@ -26,10 +26,12 @@ class SnappyMailHelper
|
|||
|
||||
$oConfig = \RainLoop\Api::Config();
|
||||
$bSave = false;
|
||||
|
||||
if (!$oConfig->Get('webmail', 'app_path')) {
|
||||
$oConfig->Set('webmail', 'app_path', \OC::$server->getAppManager()->getAppWebPath('snappymail') . '/app/');
|
||||
$bSave = true;
|
||||
}
|
||||
|
||||
if (!\is_dir(APP_PLUGINS_PATH . 'nextcloud')) {
|
||||
\SnappyMail\Repository::installPackage('plugin', 'nextcloud');
|
||||
$oConfig->Set('plugins', 'enable', true);
|
||||
|
@ -40,6 +42,14 @@ class SnappyMailHelper
|
|||
$bSave = true;
|
||||
}
|
||||
|
||||
$sPassword = $oConfig->Get('security', 'admin_password');
|
||||
if ('12345' == $sPassword || !$sPassword) {
|
||||
$sPassword = \substr(\base64_encode(\random_bytes(16)), 0, 12);
|
||||
$oConfig->SetPassword($sPassword);
|
||||
\RainLoop\Utils::saveFile(APP_PRIVATE_DATA . 'admin_password.txt', $sPassword . "\n");
|
||||
$bSave = true;
|
||||
}
|
||||
|
||||
$bSave && $oConfig->Save();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue