mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-10-31 09:33:33 +03: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
|
|
@ -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…
Add table
Add a link
Reference in a new issue