add csrf protection

This commit is contained in:
Uwe Steinmann 2021-01-25 09:00:28 +01:00
parent 6dbcd3362f
commit 64152e0d0b
2 changed files with 6 additions and 0 deletions

View File

@ -38,6 +38,11 @@ function _printMessage($heading, $message) {
return;
}
/* Check if the form data comes from a trusted request */
if(!checkFormKey('changepassword')) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_request_token"))),getMLText("invalid_request_token"));
}
if (isset($_POST["hash"])) {
$hash = $_POST["hash"];
}

View File

@ -51,6 +51,7 @@ document.form1.newpassword.focus();
$this->contentContainerStart();
?>
<form class="form-horizontal" action="../op/op.ChangePassword.php" method="post" name="form1">
<?php echo createHiddenFieldWithKey('changepassword'); ?>
<?php
if ($referuri) {
echo "<input type='hidden' name='referuri' value='".$referuri."'/>";