diff --git a/application/controllers/AccountController.php b/application/controllers/AccountController.php index 63e488fdc..3e8e6a363 100644 --- a/application/controllers/AccountController.php +++ b/application/controllers/AccountController.php @@ -73,7 +73,7 @@ class AccountController extends Controller // form to add, remove, enable & disable 2FA via TOTP - if ( $user->can('user/two-factor-authentication') ) { + if ($user->can('user/two-factor-authentication')) { if (isset($_POST['enabled_2fa'])) { Session::getSession()->set('enabled_2fa', $_POST['enabled_2fa'] == 1); } diff --git a/application/forms/Account/TotpForm.php b/application/forms/Account/TotpForm.php index 63061880b..411ea4cd4 100644 --- a/application/forms/Account/TotpForm.php +++ b/application/forms/Account/TotpForm.php @@ -105,7 +105,8 @@ class TotpForm extends PreferenceForm 'label' => $this->translate('TOTP Secret:'), 'value' => $this->totp->getSecret() ?? $this->translate('No Secret set'), 'description' => $this->translate( - 'If you generate a new TOTP secret, you will need to configure your TOTP application with this secret. ' + 'If you generate a new TOTP secret, + you will need to configure your TOTP application with this secret. ' ), 'disabled' => true, ] @@ -172,10 +173,10 @@ class TotpForm extends PreferenceForm 'decorators' => [ [ 'HtmlTag', [ - 'tag' => 'img', - 'src' => $this->totp->createQRCode(), - 'class' => 'qr-code-image' - ] + 'tag' => 'img', + 'src' => $this->totp->createQRCode(), + 'class' => 'qr-code-image' + ] ] ] ] @@ -305,7 +306,6 @@ class TotpForm extends PreferenceForm ] ] ); - } /** @@ -409,8 +409,7 @@ class TotpForm extends PreferenceForm public function isSubmitted() { - if ( - ($this->getElement('btn_generate_totp') && $this->getElement('btn_generate_totp')->isChecked()) + if (($this->getElement('btn_generate_totp') && $this->getElement('btn_generate_totp')->isChecked()) || ($this->getElement('btn_renew_totp') && $this->getElement('btn_renew_totp')->isChecked()) || ($this->getElement('btn_delete_totp') && $this->getElement('btn_delete_totp')->isChecked()) || ($this->getElement('btn_verify_totp') && $this->getElement('btn_verify_totp')->isChecked()) diff --git a/application/forms/Authentication/LoginForm.php b/application/forms/Authentication/LoginForm.php index ab4e3c82b..27b78cfdd 100644 --- a/application/forms/Authentication/LoginForm.php +++ b/application/forms/Authentication/LoginForm.php @@ -168,8 +168,7 @@ class LoginForm extends Form if ($user->getTwoFactorEnabled() && ! $user->getTwoFactorSuccessful()) { $redirect = $this->getElement('redirect'); $redirect->setValue( - Url::fromPath('authentication/login', - ['redirect' => $redirect->getValue()])->getRelativeUrl() + Url::fromPath('authentication/login', ['redirect' => $redirect->getValue()])->getRelativeUrl() ); Session::getSession()->set('must_challenge_2fa_token', true); diff --git a/library/Icinga/Authentication/Totp.php b/library/Icinga/Authentication/Totp.php index 5179a0da6..09811edd7 100644 --- a/library/Icinga/Authentication/Totp.php +++ b/library/Icinga/Authentication/Totp.php @@ -325,7 +325,9 @@ class Totp 'Failed to persist TOTP state for user %s: %s', $this->username, $e->getMessage() - ), 0, $e + ), + 0, + $e ); } @@ -615,5 +617,4 @@ class Totp return $this; } - }