2fa error impr
This commit is contained in:
@@ -50,7 +50,7 @@ class SmsUserSetup implements UserSetup
|
||||
public function getData(User $user): stdClass
|
||||
{
|
||||
if (!$this->config->get('smsProvider')) {
|
||||
throw new NotConfigured("No SMS provider. Need to configure an SMS provider.");
|
||||
throw new NotConfigured("No SMS provider.");
|
||||
}
|
||||
|
||||
return (object) [
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
"layoutSet": "Layouts from a specified set will be applied for the user instead of default ones."
|
||||
},
|
||||
"messages": {
|
||||
"2faMethodNotConfigured": "The 2FA method is not fully configured in the system.",
|
||||
"loginAs": "Open the login link in an incognito window to preserve your current session. Use your admin credentials to log in.",
|
||||
"sendPasswordChangeLinkConfirmation": "An email with a unique link will be sent to the user allowing them to change their password. The link will expire after a specific amount of time.",
|
||||
"passwordRecoverySentIfMatched": "Assuming the entered data matched any user account.",
|
||||
|
||||
@@ -30,9 +30,12 @@
|
||||
namespace Espo\Tools\UserSecurity;
|
||||
|
||||
use Espo\Core\Authentication\TwoFactor\Exceptions\NotConfigured;
|
||||
use Espo\Core\Exceptions\Error\Body;
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Exceptions\ForbiddenSilent;
|
||||
use Espo\Core\Exceptions\NotFound;
|
||||
use Espo\Core\Exceptions\BadRequest;
|
||||
use Espo\Core\Utils\Log;
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\Entities\User;
|
||||
use Espo\Entities\UserData;
|
||||
@@ -52,7 +55,8 @@ class Service
|
||||
private User $user,
|
||||
private Config $config,
|
||||
private LoginFactory $authLoginFactory,
|
||||
private TwoFactorUserSetupFactory $twoFactorUserSetupFactory
|
||||
private TwoFactorUserSetupFactory $twoFactorUserSetupFactory,
|
||||
private Log $log
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -154,7 +158,12 @@ class Service
|
||||
->getData($user);
|
||||
}
|
||||
catch (NotConfigured $e) {
|
||||
throw new Forbidden($e->getMessage());
|
||||
$this->log->error($e->getMessage());
|
||||
|
||||
throw Forbidden::createWithBody(
|
||||
"2FA method '$auth2FAMethod' is not fully configured.",
|
||||
Body::create()->withMessageTranslation('2faMethodNotConfigured', 'User')
|
||||
);
|
||||
}
|
||||
|
||||
if ($isReset) {
|
||||
|
||||
Reference in New Issue
Block a user