add csrf protection

This commit is contained in:
Uwe Steinmann 2021-01-25 09:08:40 +01:00
parent ef20172f57
commit 44813338b1
2 changed files with 6 additions and 0 deletions

View File

@ -37,6 +37,11 @@ if (!$user->isAdmin() && ($settings->_disableSelfEdit)) {
UI::exitError(getMLText("edit_user_details"),getMLText("access_denied"));
}
/* Check if the form data comes from a trusted request */
if(!checkFormKey('edituserdata')) {
UI::exitError(getMLText("edit_user_details"),getMLText("invalid_request_token"));
}
$fullname = $_POST["fullname"];
$email = $_POST["email"];
$comment = $_POST["comment"];

View File

@ -103,6 +103,7 @@ $(document).ready( function() {
$this->contentContainerStart();
?>
<form class="form-horizontal" action="../op/op.EditUserData.php" enctype="multipart/form-data" method="post" id="form">
<?php echo createHiddenFieldWithKey('edituserdata'); ?>
<?php
$this->formField(
getMLText("current_password"),