Skip to content

Commit

Permalink
Require CSRF token to edit Stripe settings - thanks to @stehled
Browse files Browse the repository at this point in the history
  • Loading branch information
wrongecho committed Nov 25, 2023
1 parent c1d0a23 commit 432488e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions post/setting.php
Expand Up @@ -331,6 +331,7 @@

if (isset($_POST['edit_online_payment_settings'])) {

validateCSRFToken($_POST['csrf_token']);
validateAdminRole();

$config_stripe_enable = intval($_POST['config_stripe_enable']);
Expand Down
5 changes: 3 additions & 2 deletions settings_online_payment.php
Expand Up @@ -11,6 +11,7 @@
</div>
<div class="card-body">
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">

<div class="form-group">
<div class="custom-control custom-switch">
Expand Down Expand Up @@ -53,9 +54,9 @@
$sql_accounts = mysqli_query($mysqli, "SELECT * FROM accounts LEFT JOIN account_types ON account_types.account_type_id = accounts.account_type WHERE account_type_parent = 1 AND account_archived_at IS NULL ORDER BY account_name ASC");
while ($row = mysqli_fetch_array($sql_accounts)) {
$account_id = intval($row['account_id']);
$account_name = nullable_htmlentities($row['account_name']);
$account_name = nullable_htmlentities($row['account_name']);
?>

<option value="<?php echo $account_id ?>" <?php if ($account_id == $config_stripe_account) { echo "selected"; } ?>><?php echo $account_name ?></option>
<?php
}
Expand Down

0 comments on commit 432488e

Please sign in to comment.