Fix add protection to avoid bypass in paymentok
This commit is contained in:
parent
656a4f36e3
commit
aab39489f2
2 changed files with 19 additions and 3 deletions
|
|
@ -783,6 +783,18 @@ if ($action == 'charge' && isModEnabled('stripe')) { // Test on permission not r
|
|||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$randomseckey = getRandomPassword(true, null, 20);
|
||||
$_SESSION['paymentkosessionkey'] = $randomseckey; // key between newpayment.php to paymentko.php
|
||||
|
||||
$urlko .= '&paymentkosessionkey='.urlencode($randomseckey);
|
||||
} else {
|
||||
$randomseckey = getRandomPassword(true, null, 20);
|
||||
$_SESSION['paymentoksessionkey'] = $randomseckey; // key between newpayment.php to paymentok.php
|
||||
|
||||
$urlok .= '&paymentoksessionkey='.urlencode($randomseckey);
|
||||
}
|
||||
}
|
||||
|
||||
// When using the PaymentIntent API architecture (mode set on by default into conf.class.php)
|
||||
|
|
|
|||
|
|
@ -379,9 +379,13 @@ if (isModEnabled('paybox')) {
|
|||
// For Stripe
|
||||
if (isModEnabled('stripe')) {
|
||||
if ($paymentmethod === 'stripe') {
|
||||
// TODO Add a check to validate that payment is ok.
|
||||
// We can request Stripe with payment_intent and payment_intent_client_secret the sameway we do in newpayment after comment "// Get here amount and currency used for payment".
|
||||
$ispaymentok = true; // We call this page only if payment is ok on payment system
|
||||
// Check we are coming from the newpaymentpage
|
||||
if (GETPOST('paymentoksessionkey') == $_SESSION['paymentoksessionkey']) {
|
||||
// We can also request Stripe with payment_intent and payment_intent_client_secret the sameway we do in newpayment after comment "// Get here amount and currency used for payment".
|
||||
$ispaymentok = true; // We call this page only if payment is ok on payment system
|
||||
} else {
|
||||
$ispaymentok = false; // We call this page only if payment is ok on payment system
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue