From 93bf838f0bc7b1008dfd8722009c3a10256a13b4 Mon Sep 17 00:00:00 2001 From: Johannes Rauh Date: Tue, 5 May 2026 14:08:56 +0200 Subject: [PATCH] Replace cancel button with a link-styled back-to-login button Replaces the cancel submit button on the 2FA challenge form with a minimal link-styled button showing an arrow-left icon and "Back to login" label. The new `.btn-back-to-login-link` style strips all button chrome (background, padding, fixed height) and only underlines the label text on hover, making it visually unobtrusive next to the primary verify button. --- .../Authentication/TwoFactorChallengeForm.php | 18 ++++++++++----- public/css/icinga/login.less | 22 +++++++++++++------ 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/application/forms/Authentication/TwoFactorChallengeForm.php b/application/forms/Authentication/TwoFactorChallengeForm.php index 88d9bc31f..884205089 100644 --- a/application/forms/Authentication/TwoFactorChallengeForm.php +++ b/application/forms/Authentication/TwoFactorChallengeForm.php @@ -12,10 +12,14 @@ use Icinga\Authentication\TwoFactorState; use Icinga\Exception\Http\HttpBadRequestException; use Icinga\Web\Session; use Icinga\Web\Url; +use ipl\Html\Attributes; use ipl\Html\FormDecoration\RenderElementDecorator; +use ipl\Html\HtmlElement; +use ipl\Html\Text; use ipl\Web\Common\CsrfCounterMeasure; use ipl\Web\Common\FormUid; use ipl\Web\Compat\CompatForm; +use ipl\Web\Widget\Icon; class TwoFactorChallengeForm extends CompatForm { @@ -57,12 +61,14 @@ class TwoFactorChallengeForm extends CompatForm 'label' => $this->translate('Verify') ]); - $this->addElement('submit', static::SUBMIT_CANCEL, [ - 'ignore' => true, - 'formnovalidate' => true, - 'class' => 'btn-cancel', - 'label' => $this->translate('Cancel'), - 'data-progress-label' => $this->translate('Canceling') + $this->addElement('submitButton', static::SUBMIT_CANCEL, [ + 'ignore' => true, + 'formnovalidate' => true, + 'class' => 'btn-back-to-login-link', + 'label' => [ + new Icon('arrow-left'), + HtmlElement::create('p', Attributes::create(), Text::create($this->translate('Back to login'))) + ] ]); $this->addElement('hidden', 'redirect', ['value' => Url::fromRequest()->getParam('redirect')]); diff --git a/public/css/icinga/login.less b/public/css/icinga/login.less index 1db812bb6..8b4ba0206 100644 --- a/public/css/icinga/login.less +++ b/public/css/icinga/login.less @@ -110,15 +110,23 @@ background-color: @icinga-secondary-dark; } - &.btn-cancel { - background: @gray; - //background: transparent; - //border: 2px solid @icinga-secondary; - //color: @icinga-secondary; + &.btn-back-to-login-link { + width: fit-content; + height: fit-content; + margin: 0 auto; + padding: 0; + background: none; + + p { + margin: 0; + } &:hover { - background-color: @icinga-secondary; - color: white; + opacity: 0.8; + + p { + text-decoration: underline; + } } } }