diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2019-01-25 03:40:03 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2019-01-25 03:40:03 +0300 |
commit | 4936fa288560aec2916e6f907b607fdc075934dd (patch) | |
tree | 78454f598812635f115f9269a9900ac3471d1905 /plugins/TwoFactorAuth | |
parent | d17e70189398fdbaf6ec5e4ead7e69950ee1c00f (diff) |
When running cron jobs or console commands, and 2FA is forced for everyone, do not fail (#14013)
* When running cron jobs or console commands, and 2FA is forced for everyone, do not fail
For tests we still enable 2FA as otherwise things wouldn't really be testable.
* Add missung use statemtn.
Diffstat (limited to 'plugins/TwoFactorAuth')
-rw-r--r-- | plugins/TwoFactorAuth/Validator.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/TwoFactorAuth/Validator.php b/plugins/TwoFactorAuth/Validator.php index 328956e44a..9840635b50 100644 --- a/plugins/TwoFactorAuth/Validator.php +++ b/plugins/TwoFactorAuth/Validator.php @@ -8,6 +8,7 @@ namespace Piwik\Plugins\TwoFactorAuth; +use Piwik\Common; use Piwik\Piwik; use Piwik\Session\SessionFingerprint; use Exception; @@ -27,6 +28,11 @@ class Validator public function canUseTwoFa() { + if (Common::isPhpCliMode() && (!defined('PIWIK_TEST_MODE') || !PIWIK_TEST_MODE)) { + // eg when archiving or executing other commands + return false; + } + if (!SettingsPiwik::isPiwikInstalled()) { return false; } |