EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
2FA in portal disabled check
Yurii285b0bd9d7d2
diff --git a/application/Espo/Core/Authentication/Authentication.php b/application/Espo/Core/Authentication/Authentication.phpindex 529a9fac6f..620497c099 100644--- a/application/Espo/Core/Authentication/Authentication.php+++ b/application/Espo/Core/Authentication/Authentication.php@@ -237,7 +237,7 @@ class Authentication!$result->bypassSecondStep() &&!$result->isSecondStepRequired() &&!$authToken &&- $this->configDataProvider->isTwoFactorEnabled()+ $this->getTwoFactorEnabled()) {$result = $this->processTwoFactor($result, $request);@@ -833,4 +833,13 @@ class Authenticationreturn $this->processFail($result, $data, $request);}++ private function getTwoFactorEnabled(): bool+ {+ if ($this->isPortal() && !$this->configDataProvider->isTwoFactorInPortalEnabled()) {+ return false;+ }++ return $this->configDataProvider->isTwoFactorEnabled();+ }}diff --git a/application/Espo/Core/Authentication/ConfigDataProvider.php b/application/Espo/Core/Authentication/ConfigDataProvider.phpindex d38960a817..ec17647d1a 100644--- a/application/Espo/Core/Authentication/ConfigDataProvider.php+++ b/application/Espo/Core/Authentication/ConfigDataProvider.php@@ -117,6 +117,16 @@ class ConfigDataProviderreturn (bool) $this->config->get('auth2FA');}+ /**+ * Whether 2FA is enabled in portals.+ *+ * @since 10.0.4+ */+ public function isTwoFactorInPortalEnabled(): bool+ {+ return (bool) $this->config->get('auth2FAInPortal');+ }+/*** Allowed methods of 2FA.*