Skip to content
Snippets Groups Projects
Verified Commit 4980b54c authored by Pavel Břoušek's avatar Pavel Břoušek
Browse files

fix: fix hiding of alternate methods

parent 9f558999
Branches
Tags
1 merge request!1Improve WebAuthn user experience
...@@ -3,10 +3,15 @@ ...@@ -3,10 +3,15 @@
use SimpleSAML\Module; use SimpleSAML\Module;
$this->data['u2fAvailable'] = !empty($this->data['u2fSignRequest']); $this->data['u2fAvailable'] = !empty($this->data['u2fSignRequest']);
$this->data['webAuthnAvailable'] = !empty($this->data['webAuthnSignRequest']); $this->data['webauthnAvailable'] = !empty($this->data['webAuthnSignRequest']);
$this->data['noAlternatives'] = !$this->data['pushAvailable'] && (!$this->data['u2fAvailable']) && (!$this->data['webAuthnAvailable']);
$this->data['mode'] = ($this->data['mode'] ?? null) ?: 'otp'; $this->data['mode'] = ($this->data['mode'] ?? null) ?: 'otp';
$this->data['noAlternatives'] = true;
foreach (['otp', 'push', 'u2f', 'webauthn'] as $mode) {
if ($mode !== $this->data['mode'] && $this->data[$mode . 'Available']) {
$this->data['noAlternatives'] = false;
break;
}
}
// Set default scenario if isn't set // Set default scenario if isn't set
if (!empty($this->data['authProcFilterScenario'])) { if (!empty($this->data['authProcFilterScenario'])) {
...@@ -259,7 +264,7 @@ if (null !== $this->data['errorCode']) { ...@@ -259,7 +264,7 @@ if (null !== $this->data['errorCode']) {
<div id="AlternateLoginOptions" class="groupMargin hidden js-show"> <div id="AlternateLoginOptions" class="groupMargin hidden js-show">
<h3><?php echo $this->t('{privacyidea:privacyidea:alternate_login_options}'); ?></h3> <h3><?php echo $this->t('{privacyidea:privacyidea:alternate_login_options}'); ?></h3>
<!-- Alternate Login Options--> <!-- Alternate Login Options-->
<?php if (($this->data['webAuthnAvailable'] ?? false) && 'webauthn' !== $this->data['mode']) { ?> <?php if (($this->data['webauthnAvailable'] ?? false) && 'webauthn' !== $this->data['mode']) { ?>
<button id="useWebAuthnButton" name="useWebAuthnButton" type="button"> <button id="useWebAuthnButton" name="useWebAuthnButton" type="button">
<span><?php echo $this->t('{privacyidea:privacyidea:webauthn}'); ?></span> <span><?php echo $this->t('{privacyidea:privacyidea:webauthn}'); ?></span>
</button> </button>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment