Cleanup MailSo Validator

Cleanup removed features
This commit is contained in:
djmaze 2020-03-20 14:53:12 +01:00
parent 8fe8369b2a
commit 1009398d0c
15 changed files with 65 additions and 192 deletions

View file

@ -1053,14 +1053,14 @@ class Actions
if (0 < \strlen($sEmail) && 0 < \strlen($sLogin) && 0 < \strlen($sPassword))
{
$oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true);
if ($oDomain instanceof \RainLoop\Model\Domain)
if ($oDomain)
{
if ($oDomain->ValidateWhiteList($sEmail, $sLogin))
{
$oAccount = \RainLoop\Model\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken, '', '', $sClientCert);
$this->Plugins()->RunHook('filter.acount', array($oAccount));
if ($bThrowProvideException && !($oAccount instanceof \RainLoop\Model\Account))
if ($bThrowProvideException && !$oAccount)
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
}
@ -1098,7 +1098,7 @@ class Actions
$oAccount = $this->LoginProvide($aAccountHash[1], $aAccountHash[2], $aAccountHash[3],
empty($aAccountHash[5]) ? '' : $aAccountHash[5], empty($aAccountHash[11]) ? '' : $aAccountHash[11], $bThrowExceptionOnFalse);
if ($oAccount instanceof \RainLoop\Model\Account)
if ($oAccount)
{
if (!empty($aAccountHash[8]) && !empty($aAccountHash[9])) // init proxy user/password
{
@ -1119,7 +1119,7 @@ class Actions
}
}
if ($bThrowExceptionOnFalse && !($oResult instanceof \RainLoop\Model\Account))
if ($bThrowExceptionOnFalse && !$oResult)
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
}
@ -1207,7 +1207,6 @@ class Actions
'materialDesign' => (bool) $oConfig->Get('labs', 'use_material_design', true),
'folderSpecLimit' => (int) $oConfig->Get('labs', 'folders_spec_limit', 50),
'faviconStatus' => (bool) $oConfig->Get('labs', 'favicon_status', true),
'allowCmdInterface' => (bool) $oConfig->Get('labs', 'allow_cmd', false),
'listPermanentFiltered' => '' !== \trim(\RainLoop\Api::Config()->Get('labs', 'imap_message_list_permanent_filter', '')),
'themes' => $this->GetThemes($bMobile, false),
'languages' => $this->GetLanguages(false),
@ -1388,8 +1387,6 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
}
else
{
$oAccount = null;
$aResult['IncludeBackground'] = $aResult['LoginBackground'];
$aResult['IncludeCss'] = $aResult['LoginCss'];
@ -1496,7 +1493,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$aResult['UserBackgroundName'] = '';
$aResult['UserBackgroundHash'] = '';
if (!$bAdmin && $oAccount instanceof \RainLoop\Model\Account)
if (!$bAdmin && $oAccount)
{
$aResult['ParentEmail'] = $oAccount->ParentEmail();
@ -1799,7 +1796,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$sLine = \trim(\implode('.', $aDomainParts), '. ');
$oDomain = $oDomainProvider->Load($sLine, false);
if ($oDomain && $oDomain instanceof \RainLoop\Model\Domain)
if ($oDomain)
{
$bAdded = true;
$this->Logger()->Write('Check "'.$sLine.'": OK ('.$sEmail.' > '.$sEmail.'@'.$sLine.')',
@ -1821,7 +1818,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
{
$sLine = $sUserHost;
$oDomain = $oDomainProvider->Load($sLine, true);
if ($oDomain && $oDomain instanceof \RainLoop\Model\Domain)
if ($oDomain && $oDomain)
{
$bAdded = true;
$this->Logger()->Write('Check "'.$sLine.'" with wildcard: OK ('.$sEmail.' > '.$sEmail.'@'.$sLine.')',
@ -1880,17 +1877,12 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
{
$oAccount = $this->LoginProvide($sEmail, $sLogin, $sPassword, $sSignMeToken, $sClientCert, true);
if (!($oAccount instanceof \RainLoop\Model\Account))
if (!$oAccount)
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
}
$this->Plugins()->RunHook('event.login-post-login-provide', array($oAccount));
if (!($oAccount instanceof \RainLoop\Model\Account))
{
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
}
}
catch (\Throwable $oException)
{
@ -3372,7 +3364,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$oDomain = $this->DomainProvider()->LoadOrCreateNewFromAction($this);
return $this->DefaultResponse(__FUNCTION__,
$oDomain instanceof \RainLoop\Model\Domain ? $this->DomainProvider()->Save($oDomain) : false);
$oDomain ? $this->DomainProvider()->Save($oDomain) : false);
}
public function DoAdminDomainAliasSave() : array
@ -4043,7 +4035,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
if (!$bDisable)
{
$oPlugin = $this->Plugins()->CreatePluginByName($sName);
if ($oPlugin && ($oPlugin instanceof \RainLoop\Plugins\AbstractPlugin))
if ($oPlugin)
{
$sValue = $oPlugin->Supported();
if (0 < \strlen($sValue))
@ -4921,7 +4913,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CantGetMessageList, $oException);
}
if ($oMessageList instanceof \MailSo\Mail\MessageCollection)
if ($oMessageList)
{
$this->cacheByKey($sRawKey);
}
@ -6276,7 +6268,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::CantGetMessage, $oException);
}
if ($oMessage instanceof \MailSo\Mail\Message)
if ($oMessage)
{
$this->Plugins()
->RunHook('filter.result-message', array($oMessage))
@ -8168,7 +8160,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
$sLanguage = $this->Config()->Get('webmail', 'language', 'en');
if ($oAccount instanceof \RainLoop\Model\Account)
if ($oAccount)
{
$oSettings = $this->SettingsProvider()->Load($oAccount);
if ($oSettings instanceof \RainLoop\Settings)

View file

@ -333,7 +333,6 @@ Enables caching in the system'),
'Experimental settings. Handle with care.
'),
'ignore_folders_subscription' => array(false),
'check_new_password_strength' => array(true),
'update_channel' => array('stable'),
'allow_prefetch' => array(true),
'allow_smart_html_links' => array(true),
@ -347,7 +346,6 @@ Enables caching in the system'),
'allow_html_editor_biti_buttons' => array(false),
'allow_ctrl_enter_on_compose' => array(true),
'try_to_detect_hidden_images' => array(false),
'hide_dangerous_actions' => array(false),
'use_app_debug_js' => array(false),
'use_mobile_version_for_tablets' => array(false),
'use_app_debug_css' => array(false),
@ -391,9 +389,6 @@ Enables caching in the system'),
'force_https' => array(false),
'custom_login_link' => array(''),
'custom_logout_link' => array(''),
'allow_external_login' => array(false),
'allow_external_sso' => array(false),
'external_sso_key' => array(''),
'http_client_ip_check_proxy' => array(false),
'fast_cache_memcache_host' => array('127.0.0.1'),
'fast_cache_memcache_port' => array(11211),
@ -407,7 +402,6 @@ Enables caching in the system'),
'replace_env_in_configuration' => array(''),
'startup_url' => array(''),
'strict_html_parser' => array(false),
'allow_cmd' => array(false),
'dev_email' => array(''),
'dev_password' => array('')
),

View file

@ -884,28 +884,6 @@ class ServiceActions
$oAccount = null;
$bLogout = true;
if ($this->oActions->Config()->Get('labs', 'allow_external_login', false))
{
$sEmail = \trim($this->oHttp->GetRequest('Email', ''));
$sPassword = $this->oHttp->GetRequest('Password', '');
try
{
$oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
$this->oActions->AuthToken($oAccount);
$bLogout = !($oAccount instanceof \RainLoop\Model\Account);
}
catch (\Throwable $oException)
{
$this->oActions->Logger()->WriteException($oException);
}
if ($bLogout)
{
$this->oActions->SetAuthLogoutToken();
}
}
switch (\strtolower($this->oHttp->GetRequest('Output', 'Redirect')))
{
case 'json':
@ -941,46 +919,6 @@ class ServiceActions
return '';
}
public function ServiceExternalSso() : string
{
$this->oHttp->ServerNoCache();
$sResult = '';
$bLogout = true;
$sKey = $this->oActions->Config()->Get('labs', 'external_sso_key', '');
if ($this->oActions->Config()->Get('labs', 'allow_external_sso', false) &&
!empty($sKey) && $sKey === \trim($this->oHttp->GetRequest('SsoKey', '')))
{
$sEmail = \trim($this->oHttp->GetRequest('Email', ''));
$sPassword = $this->oHttp->GetRequest('Password', '');
$sResult = \RainLoop\Api::GetUserSsoHash($sEmail, $sPassword);
$bLogout = 0 === \strlen($sResult);
switch (\strtolower($this->oHttp->GetRequest('Output', 'Plain')))
{
case 'plain':
@\header('Content-Type: text/plain');
break;
case 'json':
@\header('Content-Type: application/json; charset=utf-8');
$sResult = \MailSo\Base\Utils::Php2js(array(
'Action' => 'ExternalSso',
'Result' => $sResult
), $this->Logger());
break;
}
}
if ($bLogout)
{
$this->oActions->SetAuthLogoutToken();
}
return $sResult;
}
private function changeAction()
{
$this->oHttp->ServerNoCache();