mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Changes for #349
This commit is contained in:
parent
80eed213d9
commit
a06b59784a
3 changed files with 27 additions and 16 deletions
|
|
@ -8,8 +8,8 @@ class TwoFactorAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
const
|
||||
NAME = 'Two Factor Authentication',
|
||||
VERSION = '2.15.0',
|
||||
RELEASE = '2022-04-25',
|
||||
REQUIRED = '2.15.0',
|
||||
RELEASE = '2022-04-29',
|
||||
REQUIRED = '2.15.1',
|
||||
CATEGORY = 'Login',
|
||||
DESCRIPTION = 'Provides support for TOTP 2FA';
|
||||
|
||||
|
|
@ -47,7 +47,13 @@ class TwoFactorAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
public function FilterAppData($bAdmin, &$aResult)
|
||||
{
|
||||
if (!$bAdmin && \is_array($aResult)/* && isset($aResult['Auth']) && !$aResult['Auth']*/) {
|
||||
$aResult['RequireTwoFactor'] = $this->Config()->Get('plugin', 'force_two_factor_auth', false);
|
||||
$aResult['RequireTwoFactor'] = (bool) $this->Config()->Get('plugin', 'force_two_factor_auth', false);
|
||||
|
||||
$aResult['SetupTwoFactor'] = false;
|
||||
if ($aResult['RequireTwoFactor'] && !empty($aResult['Auth'])) {
|
||||
$aData = $this->getTwoFactorInfo($this->getMainAccountFromToken());
|
||||
$aResult['SetupTwoFactor'] = empty($aResult['IsSet']) || empty($mData['Enable']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +61,7 @@ class TwoFactorAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
{
|
||||
if ($this->TwoFactorAuthProvider($oAccount)) {
|
||||
$aData = $this->getTwoFactorInfo($oAccount);
|
||||
if ($aData && isset($aData['IsSet'], $aData['Enable']) && !empty($aData['Secret']) && $aData['IsSet'] && $aData['Enable']) {
|
||||
if (isset($aData['IsSet'], $aData['Enable']) && !empty($aData['Secret']) && $aData['IsSet'] && $aData['Enable']) {
|
||||
$sCode = \trim($this->jsonParam('totp_code', ''));
|
||||
if (empty($sCode)) {
|
||||
$this->Logger()->Write("TFA: Code required for {$oAccount->Email()}");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue