diff --git a/config-templates/config.php b/config-templates/config.php index 38247d6fdfb57e95fcbe4380fb47f27344a72570..1168641ea5ee65cef82c8fad48edddc2adb63d8a 100644 --- a/config-templates/config.php +++ b/config-templates/config.php @@ -222,6 +222,16 @@ $config = array ( 'consent_pdo_user' => 'simplesamluser', 'consent_pdo_passwd' => 'xxxx', + /* + * This option controls the initial focus in the consent form. + * It has three possible values: + * - NULL No initial focus. + * - 'yes' The "yes"-button has focus. + * - 'no' The "no"-button has focus. + */ + 'consent_autofocus' => NULL, + + /* * This option configures the metadata sources. The metadata sources is given as an array with * different metadata sources. When searching for metadata, simpleSAMPphp will search through diff --git a/templates/default/consent.php b/templates/default/consent.php index 2d0a3c5ecbacb5e00414fc26e77f9b88a9fca425..8810930b7fcdad208a09310df05ba1be8ea04152 100644 --- a/templates/default/consent.php +++ b/templates/default/consent.php @@ -1,5 +1,4 @@ <?php - $this->data['autofocus'] = 'yesbutton'; $this->includeAtTemplateBase('includes/header.php'); $this->includeLanguageFile('consent.php'); @@ -28,7 +27,7 @@ <?php } ?> </form> <form style="display: inline; margin-left: .5em;" action="<?php echo htmlspecialchars($this->data['noconsent']); ?>" method="GET"> - <input type="submit" value="<?php echo htmlspecialchars($this->t('no')) ?>" /> + <input type="submit" id="nobutton" value="<?php echo htmlspecialchars($this->t('no')) ?>" /> </form> <p> diff --git a/www/saml2/idp/SSOService.php b/www/saml2/idp/SSOService.php index ee6e0a020016f8874902590fd6ee6043192675a6..08583925d5c802744dff5fc8bef90a49d2fb2f56 100644 --- a/www/saml2/idp/SSOService.php +++ b/www/saml2/idp/SSOService.php @@ -297,6 +297,20 @@ if($needAuth && !$isPassive) { } $t->data['sppp'] = $privacypolicy; + switch($config->getString('consent_autofocus', NULL)) { + case NULL: + break; + case 'yes': + $t->data['autofocus'] = 'yesbutton'; + break; + case 'no': + $t->data['autofocus'] = 'nobutton'; + break; + default: + throw new Exception('Invalid value for the consent_autofocus option.' . + ' Should be one of NULL, \'yes\' or \'no\'.'); + } + $t->show(); exit; } diff --git a/www/shib13/idp/SSOService.php b/www/shib13/idp/SSOService.php index d905e07259a6a617c18c6d0a0416a847ec6c476f..110a5ff6e9c6325848eafd02fa511fcdf820ba27 100644 --- a/www/shib13/idp/SSOService.php +++ b/www/shib13/idp/SSOService.php @@ -208,6 +208,20 @@ if (!$session->isAuthenticated($authority) ) { } $t->data['sppp'] = $privacypolicy; + switch($config->getString('consent_autofocus', NULL)) { + case NULL: + break; + case 'yes': + $t->data['autofocus'] = 'yesbutton'; + break; + case 'no': + $t->data['autofocus'] = 'nobutton'; + break; + default: + throw new Exception('Invalid value for the consent_autofocus option.' . + ' Should be one of NULL, \'yes\' or \'no\'.'); + } + $t->show(); exit; }