Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 34c10d5

Browse files
Dominik Frantisek Bucikvyskocilpavel
authored andcommitted
fix: 🐛 Add check of key existence in template - unauth-acc-reg
The variable assignment has been missing checks if the keys exist in the associative array. This might have caused error page to be displayed, or at least the message has appeared in the logs. PR also includes small refactoring in order of the commands and fixes HTML tags.
1 parent 9879124 commit 34c10d5

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

templates/unauthorized-access-go-to-registration-tpl.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
use SimpleSAML\XHTML\Template;
66

77
/**
8-
* Template for inform user that he/she will be redirected to registration
9-
*
10-
* Allow type hinting in IDE
8+
* Template displaying information user that user will be redirected to registration page
119
*
1210
* @var Template $this
1311
*/
@@ -16,22 +14,22 @@
1614
$this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css" href="' .
1715
Module::getModuleUrl('perun/res/css/perun_identity_go_to_registration.css') . '" />';
1816

17+
$params = $this->data['params'];
18+
if (isset($_POST['continueToRegistration'])) {
19+
HTTP::redirectTrustedURL($_REQUEST['registerUrL'], $params);
20+
}
1921
$spMetadata = $this->data['SPMetadata'];
22+
2023
$serviceName = '';
21-
$informationURL = '';
22-
$params = $this->data['params'];
23-
if ($spMetadata['name']['en']) {
24+
if (isset($spMetadata['name']['en'])) {
2425
$serviceName = $spMetadata['name']['en'];
2526
}
2627

27-
if ($spMetadata['InformationURL']['en']) {
28+
$informationURL = '';
29+
if (isset($spMetadata['InformationURL']['en'])) {
2830
$informationURL = $spMetadata['InformationURL']['en'];
2931
}
3032

31-
if (isset($_POST['continueToRegistration'])) {
32-
HTTP::redirectTrustedURL($_REQUEST['registerUrL'], $params);
33-
}
34-
3533
$this->includeAtTemplateBase('includes/header.php');
3634

3735
$header = $this->t('{perun:perun:go-to-registration_header1}');
@@ -49,13 +47,12 @@
4947
?>
5048

5149
<form method="post">
52-
</hr>
53-
</br>
50+
<hr/>
51+
<br/>
5452
<input type="submit" name="continueToRegistration"
5553
value="<?php echo $this->t('{perun:perun:go-to-registration_continue}') ?>"
5654
class="btn btn-lg btn-primary btn-block">
57-
<div class="form-group">
58-
</div>
55+
<div class="form-group"></div>
5956
</form>
6057

6158
<?php

0 commit comments

Comments
 (0)