Skip to content
Snippets Groups Projects
Commit 60342a26 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Adding support for preselecting the remember box in the consent module

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@966 44740490-163a-0410-bde0-09ae8108e29a
parent 1ee76a62
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,8 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
* Whether or not to include attribute values when generates hash
*/
private $includeValues;
private $checked;
/**
* Consent store, if enabled.
......@@ -87,6 +89,10 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
$this->includeValues = $config['includeValues'];
}
if (array_key_exists('checked', $config)) {
$this->checked = $config['checked'];
}
if (array_key_exists('focus', $config)) {
$this->focus = $config['focus'];
if (!in_array($this->focus, array('yes', 'no'), TRUE)) {
......@@ -105,6 +111,7 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
SimpleSAML_Logger::error('Consent - constructor() : Could not create consent storage: ' . $e->getMessage());
}
}
}
......@@ -154,6 +161,7 @@ class sspmod_consent_Auth_Process_Consent extends SimpleSAML_Auth_ProcessingFilt
}
$state['consent:focus'] = $this->focus;
$state['consent:checked'] = $this->checked;
/* Save state and redirect. */
$id = SimpleSAML_Auth_State::saveState($state, 'consent:request');
......
......@@ -60,12 +60,13 @@ $attributes = $this->data['attributes'];
$this->data['header'] = 'Consent'; /* TODO: translation */
$this->includeAtTemplateBase('includes/header.php');
?>
<div id="content">
<p>
<!-- notice:<?php echo $this->t('{consent:consent_notice}'); ?> <strong><?php echo htmlspecialchars($dstName); ?></strong>. -->
<?php echo $this->t('{consent:consent_accept}', array(
'IDPNAME' => $srcName,
'SPNAME' => $dstName,
......@@ -84,11 +85,13 @@ if ($this->data['sppp'] !== FALSE) {
<form style="display: inline" action="<?php echo htmlspecialchars($this->data['yesTarget']); ?>">
<input type="submit" name="yes" id="yesbutton" value="<?php echo $this->t('{consent:yes}') ?>" />
<?php
foreach ($this->data['yesData'] as $name => $value) {
echo('<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" />');
}
if ($this->data['usestorage']) {
echo('<input type="checkbox" name="saveconsent" value="1" /> ' . $this->t('{consent:remember}'));
$checked = ($this->data['checked'] ? 'checked="checked"' : '');
echo('<input type="checkbox" name="saveconsent" ' . $checked . ' value="1" /> ' . $this->t('{consent:remember}'));
}
?>
</form>
......@@ -105,6 +108,7 @@ foreach ($this->data['noData'] as $name => $value) {
<p>
<table class="attributes">
<?php
foreach ($attributes as $name => $value) {
$nameTag = '{attributes:attribute_' . strtolower($name) . '}';
if ($this->getTag($nameTag) !== NULL) {
......@@ -127,5 +131,6 @@ foreach ($attributes as $name => $value) {
</p>
<?php
$this->includeAtTemplateBase('includes/footer.php');
?>
\ No newline at end of file
......@@ -50,6 +50,8 @@ $t->data['noTarget'] = SimpleSAML_Module::getModuleURL('consent/noconsent.php');
$t->data['noData'] = array('StateId' => $id);
$t->data['attributes'] = $state['Attributes'];
$t->data['checked'] = $state['consent:checked'];
if (array_key_exists('privacypolicy', $state['Destination'])) {
$privacypolicy = $state['Destination']['privacypolicy'];
} elseif (array_key_exists('privacypolicy', $state['Source'])) {
......@@ -63,6 +65,8 @@ if($privacypolicy !== FALSE) {
}
$t->data['sppp'] = $privacypolicy;
switch ($state['consent:focus']) {
case NULL:
break;
......@@ -80,6 +84,8 @@ if (array_key_exists('consent:store', $state)) {
$t->data['usestorage'] = FALSE;
}
$t->show();
exit;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment