Skip to content

Commit e4137a0

Browse files
committed
Prevent accidential exception pages due to repeatendly submitting a form
1 parent 5912f11 commit e4137a0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Controller/PaymentOrderController.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,11 @@ public function confirmation(
241241
//We use the paymentOrder that was stored in the token, as it is the only way to get the paymentOrder
242242
$paymentOrder = $token->getPaymentOrder();
243243

244+
//Disable confirmation form if already confirmed
245+
$formDisabled = $paymentOrder->isConfirmed() || $this->confirmationHelper->hasAlreadyConfirmed($token->getConfirmer(), $paymentOrder);
246+
244247
$form = $this->createForm(PaymentOrderConfirmationType::class, null, [
245-
//Disable confirmation form if already confirmed
246-
'disabled' => $paymentOrder->isConfirmed() || $this->confirmationHelper->hasAlreadyConfirmed($token->getConfirmer(), $paymentOrder),
248+
'disabled' => $formDisabled,
247249
]);
248250

249251
//Check if the payment order can still be deleted
@@ -282,7 +284,7 @@ public function confirmation(
282284

283285
//Handle confirmation form
284286
$form->handleRequest($request);
285-
if ($form->isSubmitted() && $form->isValid()) {
287+
if (!$formDisabled && $form->isSubmitted() && $form->isValid()) {
286288
//Do confirmation
287289
$this->confirmationHelper->confirm($paymentOrder, $token, $form->get('remark')->getData());
288290

0 commit comments

Comments
 (0)