Fix: lint-errors

This commit is contained in:
Jan Schuppik 2025-08-12 00:47:04 +02:00
parent 690f94f3db
commit b8ea4c4c5d
4 changed files with 12 additions and 13 deletions

View File

@ -73,7 +73,7 @@ class AccountController extends Controller
// form to add, remove, enable & disable 2FA via TOTP // 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'])) { if (isset($_POST['enabled_2fa'])) {
Session::getSession()->set('enabled_2fa', $_POST['enabled_2fa'] == 1); Session::getSession()->set('enabled_2fa', $_POST['enabled_2fa'] == 1);
} }

View File

@ -105,7 +105,8 @@ class TotpForm extends PreferenceForm
'label' => $this->translate('TOTP Secret:'), 'label' => $this->translate('TOTP Secret:'),
'value' => $this->totp->getSecret() ?? $this->translate('No Secret set'), 'value' => $this->totp->getSecret() ?? $this->translate('No Secret set'),
'description' => $this->translate( '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, 'disabled' => true,
] ]
@ -172,10 +173,10 @@ class TotpForm extends PreferenceForm
'decorators' => [ 'decorators' => [
[ [
'HtmlTag', [ 'HtmlTag', [
'tag' => 'img', 'tag' => 'img',
'src' => $this->totp->createQRCode(), 'src' => $this->totp->createQRCode(),
'class' => 'qr-code-image' 'class' => 'qr-code-image'
] ]
] ]
] ]
] ]
@ -305,7 +306,6 @@ class TotpForm extends PreferenceForm
] ]
] ]
); );
} }
/** /**
@ -409,8 +409,7 @@ class TotpForm extends PreferenceForm
public function isSubmitted() public function isSubmitted()
{ {
if ( if (($this->getElement('btn_generate_totp') && $this->getElement('btn_generate_totp')->isChecked())
($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_renew_totp') && $this->getElement('btn_renew_totp')->isChecked())
|| ($this->getElement('btn_delete_totp') && $this->getElement('btn_delete_totp')->isChecked()) || ($this->getElement('btn_delete_totp') && $this->getElement('btn_delete_totp')->isChecked())
|| ($this->getElement('btn_verify_totp') && $this->getElement('btn_verify_totp')->isChecked()) || ($this->getElement('btn_verify_totp') && $this->getElement('btn_verify_totp')->isChecked())

View File

@ -168,8 +168,7 @@ class LoginForm extends Form
if ($user->getTwoFactorEnabled() && ! $user->getTwoFactorSuccessful()) { if ($user->getTwoFactorEnabled() && ! $user->getTwoFactorSuccessful()) {
$redirect = $this->getElement('redirect'); $redirect = $this->getElement('redirect');
$redirect->setValue( $redirect->setValue(
Url::fromPath('authentication/login', Url::fromPath('authentication/login', ['redirect' => $redirect->getValue()])->getRelativeUrl()
['redirect' => $redirect->getValue()])->getRelativeUrl()
); );
Session::getSession()->set('must_challenge_2fa_token', true); Session::getSession()->set('must_challenge_2fa_token', true);

View File

@ -325,7 +325,9 @@ class Totp
'Failed to persist TOTP state for user %s: %s', 'Failed to persist TOTP state for user %s: %s',
$this->username, $this->username,
$e->getMessage() $e->getMessage()
), 0, $e ),
0,
$e
); );
} }
@ -615,5 +617,4 @@ class Totp
return $this; return $this;
} }
} }