This commit is contained in:
the-djmaze 2023-04-18 09:45:03 +02:00
parent c7cc250b1e
commit ad07c5b472
2 changed files with 16 additions and 12 deletions

View file

@ -35,9 +35,14 @@ class SnappyMailHelper
{ {
static::loadApp(); static::loadApp();
$oConfig = \RainLoop\Api::Config();
if (false !== \stripos(\php_sapi_name(), 'cli')) {
return;
}
try { try {
$oActions = \RainLoop\Api::Actions(); $oActions = \RainLoop\Api::Actions();
$oConfig = \RainLoop\Api::Config();
if (isset($_GET[$oConfig->Get('security', 'admin_panel_key', 'admin')])) { if (isset($_GET[$oConfig->Get('security', 'admin_panel_key', 'admin')])) {
if ($oConfig->Get('security', 'allow_admin_panel', true) if ($oConfig->Get('security', 'allow_admin_panel', true)
&& \OC_User::isAdminUser(\OC::$server->getUserSession()->getUser()->getUID()) && \OC_User::isAdminUser(\OC::$server->getUserSession()->getUser()->getUID())
@ -88,9 +93,6 @@ class SnappyMailHelper
} }
} }
} }
} catch (\Throwable $e) {
// Ignore login failure
}
if ($handle) { if ($handle) {
\header_remove('Content-Security-Policy'); \header_remove('Content-Security-Policy');
@ -98,6 +100,9 @@ class SnappyMailHelper
// https://github.com/the-djmaze/snappymail/issues/1069 // https://github.com/the-djmaze/snappymail/issues/1069
exit; exit;
} }
} catch (\Throwable $e) {
// Ignore login failure
}
} }
public static function getLoginCredentials() : array public static function getLoginCredentials() : array

View file

@ -11,8 +11,7 @@ abstract class Service
{ {
static $bOne = null; static $bOne = null;
if (null === $bOne) { if (null === $bOne) {
$bOne = false === \stripos(\php_sapi_name(), 'cli') $bOne = static::RunResult();
&& static::RunResult();
} }
return $bOne; return $bOne;