diff --git a/dev/Storages/AdminAjaxRemote.js b/dev/Storages/AdminAjaxRemote.js index 0349e6602..73deb9a49 100644 --- a/dev/Storages/AdminAjaxRemote.js +++ b/dev/Storages/AdminAjaxRemote.js @@ -203,11 +203,12 @@ AdminAjaxRemoteStorage.prototype.createOrUpdateDomain = function (fCallback, }); }; -AdminAjaxRemoteStorage.prototype.testConnectionForDomain = function (fCallback, +AdminAjaxRemoteStorage.prototype.testConnectionForDomain = function (fCallback, sName, sIncHost, iIncPort, sIncSecure, sOutHost, iOutPort, sOutSecure, bOutAuth) { this.defaultRequest(fCallback, 'AdminDomainTest', { + 'Name': sName, 'IncHost': sIncHost, 'IncPort': iIncPort, 'IncSecure': sIncSecure, diff --git a/dev/Storages/AdminData.js b/dev/Storages/AdminData.js index b738a7f31..09d616c28 100644 --- a/dev/Storages/AdminData.js +++ b/dev/Storages/AdminData.js @@ -26,6 +26,14 @@ function AdminDataStorage() this.licenseError = ko.observable(''); this.licenseTrigger = ko.observable(false); + + this.adminManLoading = ko.computed(function () { + return '000' !== [this.domainsLoading() ? '1' : '0', this.pluginsLoading() ? '1' : '0', this.packagesLoading() ? '1' : '0'].join(''); + }, this); + + this.adminManLoadingVisibility = ko.computed(function () { + return this.adminManLoading() ? 'visible' : 'hidden'; + }, this).extend({'rateLimit': 300}); } _.extend(AdminDataStorage.prototype, AbstractData.prototype); diff --git a/dev/ViewModels/AdminPaneViewModel.js b/dev/ViewModels/AdminPaneViewModel.js index 128c09551..86b749ee3 100644 --- a/dev/ViewModels/AdminPaneViewModel.js +++ b/dev/ViewModels/AdminPaneViewModel.js @@ -11,6 +11,8 @@ function AdminPaneViewModel() this.adminDomain = ko.observable(RL.settingsGet('AdminDomain')); this.version = ko.observable(RL.settingsGet('Version')); + this.adminManLoadingVisibility = RL.data().adminManLoadingVisibility; + Knoin.constructorEnd(this); } diff --git a/dev/ViewModels/PopupsDomainViewModel.js b/dev/ViewModels/PopupsDomainViewModel.js index e33d0d07f..77f19d6fd 100644 --- a/dev/ViewModels/PopupsDomainViewModel.js +++ b/dev/ViewModels/PopupsDomainViewModel.js @@ -35,20 +35,6 @@ function PopupsDomainViewModel() this.smtpAuth = ko.observable(true); this.whiteList = ko.observable(''); - this.imapServerFocus.subscribe(function (bValue) { - if (bValue && '' !== this.name() && '' === this.imapServer()) - { - this.imapServer(this.name().replace(/[.]?[*][.]?/g, '')); - } - }, this); - - this.smtpServerFocus.subscribe(function (bValue) { - if (bValue && '' !== this.imapServer() && '' === this.smtpServer()) - { - this.smtpServer(this.imapServer().replace(/imap/ig, 'smtp')); - } - }, this); - this.headerText = ko.computed(function () { var sName = this.name(); return this.edit() ? 'Edit Domain "' + sName + '"' : @@ -98,6 +84,7 @@ function PopupsDomainViewModel() this.testing(true); RL.remote().testConnectionForDomain( _.bind(this.onTestConnectionResponse, this), + this.name(), this.imapServer(), this.imapPort(), this.imapSecure(), @@ -112,6 +99,67 @@ function PopupsDomainViewModel() this.whiteListPage(!this.whiteListPage()); }); + // smart form improvements + this.imapServerFocus.subscribe(function (bValue) { + if (bValue && '' !== this.name() && '' === this.imapServer()) + { + this.imapServer(this.name().replace(/[.]?[*][.]?/g, '')); + } + }, this); + + this.smtpServerFocus.subscribe(function (bValue) { + if (bValue && '' !== this.imapServer() && '' === this.smtpServer()) + { + this.smtpServer(this.imapServer().replace(/imap/ig, 'smtp')); + } + }, this); + + this.imapSecure.subscribe(function (sValue) { + var iPort = Utils.pInt(this.imapPort()); + sValue = Utils.pString(sValue); + switch (sValue) + { + case '0': + if (993 === iPort) + { + this.imapPort(143); + } + break; + case '1': + if (143 === iPort) + { + this.imapPort(993); + } + break; + } + }, this); + + this.smtpSecure.subscribe(function (sValue) { + var iPort = Utils.pInt(this.smtpPort()); + sValue = Utils.pString(sValue); + switch (sValue) + { + case '0': + if (465 === iPort || 587 === iPort) + { + this.smtpPort(25); + } + break; + case '1': + if (25 === iPort || 587 === iPort) + { + this.smtpPort(465); + } + break; + case '2': + if (25 === iPort || 465 === iPort) + { + this.smtpPort(587); + } + break; + } + }, this); + Knoin.constructorEnd(this); } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Account.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Account.php index 341a8ab18..26e8e7110 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Account.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Account.php @@ -166,8 +166,9 @@ class Account */ public function Hash() { - return md5(APP_SALT.$this->Email().APP_SALT.$this->oDomain->IncHost().APP_SALT.$this->oDomain->IncPort(). - APP_SALT.$this->Password().APP_SALT.'0'.APP_SALT.$this->ParentEmail().APP_SALT); + + return md5(APP_SALT.$this->Email().APP_SALT.$this->oDomain->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($this->Email())). + APP_SALT.$this->oDomain->IncPort().APP_SALT.$this->Password().APP_SALT.'0'.APP_SALT.$this->ParentEmail().APP_SALT); } /** diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 31a8ac8be..a9387ce8a 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -231,10 +231,8 @@ class Actions $oResult = new \RainLoop\Providers\Login\DefaultLogin(); break; case 'domain': - // \RainLoop\Providers\Domain\DomainSimpleInterface // \RainLoop\Providers\Domain\DomainAdminInterface - $oResult = new \RainLoop\Providers\Domain\DefaultDomain(APP_PRIVATE_DATA.'domains', - $this->Cacher()); + $oResult = new \RainLoop\Providers\Domain\DefaultDomain(APP_PRIVATE_DATA.'domains', $this->Cacher()); break; case 'address-book': // \RainLoop\Providers\AddressBook\AddressBookInterface @@ -849,7 +847,7 @@ 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\Domain && !$oDomain->Disabled() && $oDomain->ValidateWhiteList($sEmail, $sLogin)) + if ($oDomain instanceof \RainLoop\Domain && $oDomain->ValidateWhiteList($sEmail, $sLogin)) { $oResult = \RainLoop\Account::NewInstance($sEmail, $sLogin, $sPassword, $oDomain, $sSignMeToken); } @@ -892,7 +890,7 @@ class Actions $oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($aAccountHash[1]), true); if ($bThrowExceptionOnFalse) { - if (!($oDomain instanceof \RainLoop\Domain) || $oDomain->Disabled()) + if (!($oDomain instanceof \RainLoop\Domain)) { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainNotAllowed); } @@ -1374,7 +1372,7 @@ class Actions $this->loginErrorDelay(); $oDomain = $this->DomainProvider()->Load(\MailSo\Base\Utils::GetDomainFromEmail($sEmail), true); - if (!($oDomain instanceof \RainLoop\Domain) || $oDomain->Disabled()) + if (!($oDomain instanceof \RainLoop\Domain)) { throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainNotAllowed); } @@ -1439,7 +1437,8 @@ class Actions try { $this->MailClient() - ->Connect($oAccount->Domain()->IncHost(), $oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure()) + ->Connect($oAccount->Domain()->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())), + $oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure()) ->Login($oAccount->IncLogin(), $oAccount->Password()) ; } @@ -2458,9 +2457,9 @@ class Actions $oImapClient = \MailSo\Imap\ImapClient::NewInstance()->SetLogger($this->Logger()); $oImapClient->SetTimeOuts(5); - $iTime = microtime(true); - $oImapClient->Connect($oDomain->IncHost(), $oDomain->IncPort(), $oDomain->IncSecure()); - $iImapTime = microtime(true) - $iTime; + $iTime = \microtime(true); + $oImapClient->Connect($oDomain->IncHost($oDomain->Name()), $oDomain->IncPort(), $oDomain->IncSecure()); + $iImapTime = \microtime(true) - $iTime; $oImapClient->Disconnect(); $bImapResult = true; } @@ -2474,9 +2473,9 @@ class Actions $oSmtpClient = \MailSo\Smtp\SmtpClient::NewInstance()->SetLogger($this->Logger()); $oSmtpClient->SetTimeOuts(5); - $iTime = microtime(true); - $oSmtpClient->Connect($oDomain->OutHost(), $oDomain->OutPort(), '127.0.0.1', $oDomain->OutSecure()); - $iSmtpTime = microtime(true) - $iTime; + $iTime = \microtime(true); + $oSmtpClient->Connect($oDomain->OutHost($oDomain->Name()), $oDomain->OutPort(), '127.0.0.1', $oDomain->OutSecure()); + $iSmtpTime = \microtime(true) - $iTime; $oSmtpClient->Disconnect(); $bSmtpResult = true; } @@ -4249,7 +4248,7 @@ class Actions $aSmtpCredentials = array( 'Ehlo' => \MailSo\Smtp\SmtpClient::EhloHelper(), - 'Host' => $oAccount->Domain()->OutHost(), + 'Host' => $oAccount->Domain()->OutHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())), 'Port' => $oAccount->Domain()->OutPort(), 'Secure' => $oAccount->Domain()->OutSecure(), 'UseAuth' => $oAccount->Domain()->OutAuth(), @@ -6160,7 +6159,8 @@ class Actions try { $this->MailClient() - ->Connect($oAccount->Domain()->IncHost(), $oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure()) + ->Connect($oAccount->Domain()->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())), + $oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure()) ->Login($oAccount->IncLogin(), $oAccount->Password(), !!$this->Config()->Get('labs', 'use_imap_auth_plain')) ; } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Domain.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Domain.php index 9dc12aed0..b3a3b57b5 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Domain.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Domain.php @@ -63,11 +63,6 @@ class Domain */ private $sWhiteList; - /** - * @var bool - */ - private $bDisabled; - /** * @param string $sName * @param string $sIncHost @@ -95,7 +90,6 @@ class Domain $this->bOutShortLogin = $bOutShortLogin; $this->bOutAuth = $bOutAuth; $this->sWhiteList = \trim($sWhiteList); - $this->bDisabled = false; } /** @@ -125,6 +119,7 @@ class Domain } /** + * @param string $sName * @param array $aDomain * * @return \RainLoop\Domain|null @@ -171,14 +166,6 @@ class Domain return str_replace('"', '\\"', $sStr); } - /** - * @param bool0 $bDisabled - */ - public function SetDisabled($bDisabled) - { - $this->bDisabled = (bool) $bDisabled; - } - public function Normalize() { $this->sIncHost = \trim($this->sIncHost); @@ -299,11 +286,13 @@ class Domain } /** + * @param string $sRealDomainName = '' + * * @return string */ - public function IncHost() + public function IncHost($sRealDomainName = '') { - return $this->sIncHost; + return 0 < \strlen($sRealDomainName) ? \str_replace('{domain:name}', $sRealDomainName, $this->sIncHost) : $this->sIncHost; } /** @@ -331,11 +320,12 @@ class Domain } /** + * @param string $sRealDomainName = '' * @return string */ - public function OutHost() + public function OutHost($sRealDomainName = '') { - return $this->sOutHost; + return 0 < \strlen($sRealDomainName) ? \str_replace('{domain:name}', $sRealDomainName, $this->sOutHost) : $this->sOutHost; } /** @@ -378,14 +368,6 @@ class Domain return $this->sWhiteList; } - /** - * @return bool - */ - public function Disabled() - { - return $this->bDisabled; - } - /** * @param string $sEmail * @param string $sLogin = '' diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain.php index 438807164..e9b43b088 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain.php @@ -35,13 +35,13 @@ class Domain extends \RainLoop\Providers\AbstractProvider /** * @param string $sName - * @param bool $bDefaultOnNull = false + * @param bool $bFindWithWildCard = false * * @return \RainLoop\Domain|null */ - public function Load($sName, $bDefaultOnNull = false) + public function Load($sName, $bFindWithWildCard = false) { - return $this->oDriver->Load($sName, $bDefaultOnNull); + return $this->oDriver->Load($sName, $bFindWithWildCard); } /** @@ -122,6 +122,11 @@ class Domain extends \RainLoop\Providers\AbstractProvider $bOutAuth = '1' === (string) $oActions->GetActionParam('OutAuth', '1'); $sWhiteList = (string) $oActions->GetActionParam('WhiteList', ''); + if (0 < \strlen($sName) && 0 < strlen($sNameForTest) && false === \strpos($sName, '*')) + { + $sNameForTest = ''; + } + if (0 < strlen($sName) || 0 < strlen($sNameForTest)) { $oDomain = 0 < strlen($sNameForTest) ? null : $this->Load($sName); diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain/DefaultDomain.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain/DefaultDomain.php index d4f3fd412..4bbff653e 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain/DefaultDomain.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain/DefaultDomain.php @@ -141,15 +141,22 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface public function Load($sName, $bFindWithWildCard = false) { $mResult = null; - + + $sDisabled = ''; $sFoundedValue = ''; $sName = \strtolower($sName); $sRealFileName = $this->codeFileName($sName); - - if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini')) + + if (\file_exists($this->sDomainPath.'/disabled')) { - $aDomain = @\parse_ini_file($this->sDomainPath.'/'.$sRealFileName.'.ini'); + $sDisabled = @\file_get_contents($this->sDomainPath.'/disabled'); + } + + if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini') && + (0 === \strlen($sDisabled) || false === \strpos(\strtolower(','.$sDisabled.','), \strtolower(','.$sName.',')))) + { + $aDomain = @\parse_ini_file($this->sDomainPath.'/'.$sRealFileName.'.ini'); // fix misspellings (#119) if (\is_array($aDomain)) { @@ -184,20 +191,10 @@ class DefaultDomain implements \RainLoop\Providers\Domain\DomainAdminInterface { if (\RainLoop\Plugins\Helper::ValidateWildcardValues($sName, $sNames, $sFoundedValue) && 0 < \strlen($sFoundedValue)) { - $mResult = $this->Load($sFoundedValue, false); - } - } - } - - if ($mResult instanceof \RainLoop\Domain) - { - if (\file_exists($this->sDomainPath.'/disabled')) - { - $sDisabled = @\file_get_contents($this->sDomainPath.'/disabled'); - if (false !== $sDisabled && 0 < \strlen($sDisabled)) - { - $sDisabledName = 0 < \strlen($sFoundedValue) ? $sFoundedValue : $sName; - $mResult->SetDisabled(false !== \strpos(strtolower(','.$sDisabled.','), \strtolower(','.$sDisabledName.','))); + if (0 === \strlen($sDisabled) || false === \strpos(\strtolower(','.$sDisabled.','), \strtolower(','.$sFoundedValue.','))) + { + $mResult = $this->Load($sFoundedValue, false); + } } } } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain/DomainAdminInterface.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain/DomainAdminInterface.php index 39e26d5a2..e48befb60 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain/DomainAdminInterface.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Domain/DomainAdminInterface.php @@ -1,49 +1,50 @@ -

+ +    Admin Panel    ( – ) diff --git a/rainloop/v/0.0.0/app/templates/Views/AdminSettingsDomains.html b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsDomains.html index e365f60ca..6d40585cc 100644 --- a/rainloop/v/0.0.0/app/templates/Views/AdminSettingsDomains.html +++ b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsDomains.html @@ -3,21 +3,20 @@ Domains

-
-

- List of domains webmail is allowed to access. -

-
   Add Domain -
- -    - loading... -
+
+
+
+

+ List of domains webmail is allowed to access. +
+ Click on the name to configure the domain. +

+
diff --git a/rainloop/v/0.0.0/app/templates/Views/AdminSettingsPackages.html b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsPackages.html index c4300c065..6779dfa78 100644 --- a/rainloop/v/0.0.0/app/templates/Views/AdminSettingsPackages.html +++ b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsPackages.html @@ -4,23 +4,17 @@ Cannot access the repository at the moment. - -
-
+
Available for Update () diff --git a/rainloop/v/0.0.0/app/templates/Views/AdminSettingsPlugins.html b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsPlugins.html index 4dfb8ee52..eb77b3f47 100644 --- a/rainloop/v/0.0.0/app/templates/Views/AdminSettingsPlugins.html +++ b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsPlugins.html @@ -7,16 +7,16 @@
-
+ +
Plugins
- +