Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.

Commit 105f3f0

Browse files
authored
Merge pull request #99 from silinternational/feature/handle-absent-csrf-gracefully
Only add the CSRF token to the login form if one was provided
2 parents dc3bb90 + e85fb73 commit 105f3f0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

themes/material/core/loginuserpass.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,13 @@ function onRecaptchaLoad() {
5454
<input type="hidden" name="AuthState" value="<?= htmlentities($this->data['stateparams']['AuthState']) ?>" />
5555

5656
<?php
57-
$csrfToken = htmlentities($this->data['csrfToken']);
57+
if (key_exists('csrfToken', $this->data)) {
58+
$csrfToken = htmlentities($this->data['csrfToken']);
59+
?>
60+
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>" />
61+
<?php
62+
}
5863
?>
59-
<input type="hidden" name="csrf-token" value="<?= $csrfToken ?>" />
6064

6165
<div class="mdl-card mdl-shadow--8dp fill-phone-viewport">
6266
<div class="mdl-card__media white-bg margin" layout-children="column">

0 commit comments

Comments
 (0)