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.
This commit is contained in:
Johannes Rauh 2026-05-05 14:08:56 +02:00
parent 08e656baa4
commit 93bf838f0b
2 changed files with 27 additions and 13 deletions

View file

@ -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')]);

View file

@ -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;
}
}
}
}