diff options
Diffstat (limited to 'plugins/TwoFactorAuth/Controller.php')
-rw-r--r-- | plugins/TwoFactorAuth/Controller.php | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/plugins/TwoFactorAuth/Controller.php b/plugins/TwoFactorAuth/Controller.php index 72bee05c88..fdbe4fb8ef 100644 --- a/plugins/TwoFactorAuth/Controller.php +++ b/plugins/TwoFactorAuth/Controller.php @@ -152,9 +152,6 @@ class Controller extends \Piwik\Plugin\Controller public function onLoginSetupTwoFactorAuth() { // called when 2fa is required, but user has not yet set up 2fa - $this->validator->checkCanUseTwoFa(); - $this->validator->check2FaNotEnabled(); - $this->validator->check2FaIsRequired(); return $this->setupTwoFactorAuth($standalone = true); } @@ -249,7 +246,7 @@ class Controller extends \Piwik\Plugin\Controller $view->AccessErrorString = $accessErrorString; $view->isAlreadyUsing2fa = $this->twoFa->isUserUsingTwoFactorAuthentication($login); $view->newSecret = $secret; - $view->authImage = $this->getQRUrl($view->description, $view->gatitle); + $view->twoFaBarCodeSetupUrl = $this->getTwoFaBarCodeSetupUrl($secret); $view->codes = $this->recoveryCodeDao->getAllRecoveryCodesForLogin($login); $view->standalone = $standalone; @@ -294,15 +291,8 @@ class Controller extends \Piwik\Plugin\Controller )); } - public function showQrCode() + private function getTwoFaBarCodeSetupUrl($secret) { - $this->validator->checkCanUseTwoFa(); - - $session = $this->make2faSession(); - $secret = $session->secret; - if (empty($secret)) { - throw new Exception('Not available'); - } $title = $this->settings->twoFactorAuthTitle->getValue(); $descr = Piwik::getCurrentUserLogin(); @@ -311,10 +301,7 @@ class Controller extends \Piwik\Plugin\Controller $url .= '&issuer='.urlencode($title); } - $qrCode = new QrCode($url); - - header('Content-Type: '.$qrCode->getContentType()); - echo $qrCode->get(); + return $url; } protected function getQRUrl($description, $title) |