diff --git a/modules/expirycheck/templates/about2expire.php b/modules/expirycheck/templates/about2expire.php index e2be96973a3344bac195bbc1ada897dcdede511c..f8749fdf6203c1076a1ab1c9de70183358f02402 100644 --- a/modules/expirycheck/templates/about2expire.php +++ b/modules/expirycheck/templates/about2expire.php @@ -16,50 +16,6 @@ * @package SimpleSAMLphp */ -# netid will expire today -if ($this->data['daysleft'] == 0) { - $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header_today}', array( - '%NETID%' => htmlspecialchars($this->data['netId']) - )); - - $warning = $this->t('{expirycheck:expwarning:warning_today}', array( - '%NETID%' => htmlspecialchars($this->data['netId']) - )); - -} -# netid will expire in one day -elseif ($this->data['daysleft'] == 1) { - - $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header}', array( - '%NETID%' => htmlspecialchars($this->data['netId']), - '%DAYS%' => $this->t('{expirycheck:expwarning:day}'), - '%DAYSLEFT%' => htmlspecialchars($this->data['daysleft']), - )); - - $warning = $this->t('{expirycheck:expwarning:warning}', array( - '%NETID%' => htmlspecialchars($this->data['netId']), - '%DAYS%' => $this->t('{expirycheck:expwarning:day}'), - '%DAYSLEFT%' => htmlspecialchars($this->data['daysleft']), - )); - -} -# netid will expire in next <daysleft> days -else { - $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header}', array( - '%NETID%' => htmlspecialchars($this->data['netId']), - '%DAYS%' => $this->t('{expirycheck:expwarning:days}'), - '%DAYSLEFT%' => htmlspecialchars($this->data['daysleft']), - )); - - $warning = $this->t('{expirycheck:expwarning:warning}', array( - '%NETID%' => htmlspecialchars($this->data['netId']), - '%DAYS%' => $this->t('{expirycheck:expwarning:days}'), - '%DAYSLEFT%' => htmlspecialchars($this->data['daysleft']), - )); - - -} - $this->data['autofocus'] = 'yesbutton'; $this->includeAtTemplateBase('includes/header.php'); diff --git a/modules/expirycheck/templates/about2expire.twig b/modules/expirycheck/templates/about2expire.twig new file mode 100644 index 0000000000000000000000000000000000000000..c60788051a4a8339aeb5f86a986062dfb80b4360 --- /dev/null +++ b/modules/expirycheck/templates/about2expire.twig @@ -0,0 +1,13 @@ +{% set pagetitle = 'SimpleSAMLphp'|trans %} +{% extends "base.twig" %} + +{% block content %} + <form style="display: inline; margin: 0px; padding: 0px" action="{{ yesTarget|escape('html') }}"> + {% for name, value in yesData %} + <input type="hidden" name="{{ name|escape('html') }}" value="{{ value|escape('html') }}" /> + {% endfor %} + <h3>{{ warning }}</h3> + <p>{{ '{expirycheck:expwarning:expiry_date_text}'|trans }} {{ expireOnDate }}</p> + <input type="submit" name="yes" id="yesbutton" value="{{ '{expirycheck:expwarning:btn_continue}'|trans }}" /> + </form> +{% endblock %} diff --git a/modules/expirycheck/templates/expired.twig b/modules/expirycheck/templates/expired.twig new file mode 100644 index 0000000000000000000000000000000000000000..8c0cecbc116646505319812cd30ecb088c069ae7 --- /dev/null +++ b/modules/expirycheck/templates/expired.twig @@ -0,0 +1,9 @@ +{% set pagetitle = 'SimpleSAMLphp'|trans %} +{% extends "base.twig" %} + +{% block content %} + <h2>{{ '{expirycheck:expwarning:access_denied}'|trans }})</h2> + <p>{{ '{expirycheck:expwarning:no_access_to}'|trans({'%NETID%': netId}, "app") }}</p> + <p>{{ '{expirycheck:expwarning:expiry_date_text}'|trans }} <b>{{ expireOnDate }}</b></p> + <p>{{ '{expirycheck:expwarning:contact_home}'|trans }}</p> +{% endblock %} diff --git a/modules/expirycheck/www/about2expire.php b/modules/expirycheck/www/about2expire.php index 089d82985956d9fdc2e94c4f632efc830bfeb041..ddb438b17d133ea33007e5eb6c441a9e6a376d1a 100644 --- a/modules/expirycheck/www/about2expire.php +++ b/modules/expirycheck/www/about2expire.php @@ -9,22 +9,61 @@ SimpleSAML\Logger::info('expirycheck - User has been warned that NetID is near to expirational date.'); if (!array_key_exists('StateId', $_REQUEST)) { - throw new SimpleSAML_Error_BadRequest('Missing required StateId query parameter.'); + throw new SimpleSAML_Error_BadRequest('Missing required StateId query parameter.'); } $id = $_REQUEST['StateId']; $state = SimpleSAML_Auth_State::loadState($id, 'expirywarning:about2expire'); if (array_key_exists('yes', $_REQUEST)) { - // The user has pressed the yes-button - SimpleSAML_Auth_ProcessingChain::resumeProcessing($state); + // The user has pressed the yes-button + SimpleSAML_Auth_ProcessingChain::resumeProcessing($state); } $globalConfig = SimpleSAML_Configuration::getInstance(); +$daysleft = $state['daysleft']; + $t = new SimpleSAML_XHTML_Template($globalConfig, 'expirycheck:about2expire.php'); +$t->data['autofocus'] = 'yesbutton'; $t->data['yesTarget'] = SimpleSAML\Module::getModuleURL('expirycheck/about2expire.php'); $t->data['yesData'] = array('StateId' => $id); -$t->data['daysleft'] = $state['daysleft']; +$t->data['warning'] = $warning; $t->data['expireOnDate'] = $state['expireOnDate']; $t->data['netId'] = $state['netId']; + +if ($daysleft == 0) { + # netid will expire today + $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header_today}', array( + '%NETID%' => htmlspecialchars($this->data['netId']) + )); + $this->data['warning'] = $this->t('{expirycheck:expwarning:warning_today}', array( + '%NETID%' => htmlspecialchars($this->data['netId']) + )); +} elseif ($daysleft == 1) { + # netid will expire in one day + + $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header}', array( + '%NETID%' => htmlspecialchars($this->data['netId']), + '%DAYS%' => $this->t('{expirycheck:expwarning:day}'), + '%DAYSLEFT%' => htmlspecialchars($daysleft), + )); + $this->data['warning'] = $this->t('{expirycheck:expwarning:warning}', array( + '%NETID%' => htmlspecialchars($this->data['netId']), + '%DAYS%' => $this->t('{expirycheck:expwarning:day}'), + '%DAYSLEFT%' => htmlspecialchars($daysleft), + )); +} else { + # netid will expire in next <daysleft> days + $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header}', array( + '%NETID%' => htmlspecialchars($this->data['netId']), + '%DAYS%' => $this->t('{expirycheck:expwarning:days}'), + '%DAYSLEFT%' => htmlspecialchars($daysleft), + )); + $this->data['warning'] = $this->t('{expirycheck:expwarning:warning}', array( + '%NETID%' => htmlspecialchars($this->data['netId']), + '%DAYS%' => $this->t('{expirycheck:expwarning:days}'), + '%DAYSLEFT%' => htmlspecialchars($daysleft), + )); +} + $t->show(); diff --git a/modules/expirycheck/www/expired.php b/modules/expirycheck/www/expired.php index 87eef83dadb4a5bb2a7db2bb0090d1c8bdda020a..47fbd21164f975bd45481ff27de0e677a790852c 100644 --- a/modules/expirycheck/www/expired.php +++ b/modules/expirycheck/www/expired.php @@ -9,13 +9,14 @@ SimpleSAML\Logger::info('expirycheck - User has been warned that NetID is near to expirational date.'); if (!array_key_exists('StateId', $_REQUEST)) { - throw new SimpleSAML_Error_BadRequest('Missing required StateId query parameter.'); + throw new SimpleSAML_Error_BadRequest('Missing required StateId query parameter.'); } $state = SimpleSAML_Auth_State::loadState($_REQUEST['StateId'], 'expirywarning:expired'); $globalConfig = SimpleSAML_Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($globalConfig, 'expirycheck:expired.php'); -$t->data['expireOnDate'] = $state['expireOnDate']; -$t->data['netId'] = $state['netId']; +$t->data['header'] = $this->t('{expirycheck:expwarning:access_denied}'); +$t->data['expireOnDate'] = htmlspecialchars($state['expireOnDate']); +$t->data['netId'] = htmlspecialchars($state['netId']); $t->show();