diff --git a/plugins/two-factor-auth/index.php b/plugins/two-factor-auth/index.php index 590cebaea..b40a6155e 100644 --- a/plugins/two-factor-auth/index.php +++ b/plugins/two-factor-auth/index.php @@ -7,9 +7,9 @@ class TwoFactorAuthPlugin extends \RainLoop\Plugins\AbstractPlugin { const NAME = 'Two Factor Authentication', - VERSION = '2.15.1', - RELEASE = '2022-05-02', - REQUIRED = '2.15.1', + VERSION = '2.16', + RELEASE = '2022-05-20', + REQUIRED = '2.15.2', CATEGORY = 'Login', DESCRIPTION = 'Provides support for TOTP 2FA'; @@ -52,7 +52,7 @@ class TwoFactorAuthPlugin extends \RainLoop\Plugins\AbstractPlugin $aResult['SetupTwoFactor'] = false; if ($aResult['RequireTwoFactor'] && !empty($aResult['Auth'])) { $aData = $this->getTwoFactorInfo($this->getMainAccountFromToken()); - $aResult['SetupTwoFactor'] = empty($aResult['IsSet']) || empty($mData['Enable']); + $aResult['SetupTwoFactor'] = empty($aData['IsSet']) || empty($aData['Enable']) || empty($aData['Secret']); } } } diff --git a/plugins/two-factor-auth/js/TwoFactorAuthSettings.js b/plugins/two-factor-auth/js/TwoFactorAuthSettings.js index d8a587901..79d8c6bb5 100644 --- a/plugins/two-factor-auth/js/TwoFactorAuthSettings.js +++ b/plugins/two-factor-auth/js/TwoFactorAuthSettings.js @@ -106,7 +106,12 @@ class TwoFactorAuthSettings } testTwoFactor() { - TwoFactorAuthTestPopupView.showModal([this.twoFactorTested]); + TwoFactorAuthTestPopupView.showModal([ + () => { + this.twoFactorTested(true); + this.viewEnable(true); + } + ]); } clearTwoFactor() { @@ -188,15 +193,15 @@ class TwoFactorAuthTestPopupView extends rl.pluginPopupView { Remote.verifyCode(iError => { this.testing(false); this.codeStatus(!iError); - this.twoFactorTested(!iError); + iError || (this.onSuccess() | this.close()); }, this.code()); } - onShow(twoFactorTested) { + onShow(onSuccess) { this.code(''); this.codeStatus(null); this.testing(false); - this.twoFactorTested = twoFactorTested; + this.onSuccess = onSuccess; } }