feat: ochrona przed podwójnym składaniem zamówienia (order submit token)

Token CSRF w sesji zapobiega duplikowaniu zamówień przy wielokrotnym
kliknięciu przycisku. Przy duplikacie przekierowanie do istniejącego
zamówienia. JS naprawiony — nasłuch na submit formularza zamiast click.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jacek
2026-03-10 21:50:21 +01:00
parent e0a1847127
commit c7be154d57
8 changed files with 151 additions and 20 deletions

View File

@@ -34,6 +34,7 @@
<? endif;?>
<? if ( $this -> client ):?><div class="right"><? endif;?>
<form class="form-horizontal" action="/zloz-zamowienie" method="POST" id="form-order">
<input type="hidden" name="order_submit_token" value="<?= htmlspecialchars( (string)($this -> order_submit_token ?? ''), ENT_QUOTES, 'UTF-8' );?>">
<? if ( !$this -> client ):?>
<div class="form-group row">
<div class="col-12">
@@ -198,4 +199,4 @@
$( '#address-' + address_id ).addClass( 'active' );
});
});
</script>
</script>