Skip to content

Commit

Permalink
Fixed security based on customer id on add and edit book
Browse files Browse the repository at this point in the history
  • Loading branch information
CySSoO committed Nov 30, 2020
1 parent 82b6962 commit e91deb9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
9 changes: 1 addition & 8 deletions controllers/front/addbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ public function initContent()
$link->getPageLink('authentication', true)
);
}

if ($cart->id_customer == 0
|| !$this->module->active) {
Tools::redirect(
$link->getPageLink('my-account', true)
);
}
if ((bool)EverPsBookstoreSeller::isBookstoreSeller() === false) {
Tools::redirect(
$link->getPageLink('my-account', true)
Expand Down Expand Up @@ -136,7 +129,7 @@ public function postProcess()
);
}
$bookstore_seller = EverPsBookstoreSeller::getBookstoreSellerByCustomerId(
(int)Tools::getValue('id_bookstore_seller')
(int)Context::getContext()->customer->id
);
if (!Validate::isLoadedObject($bookstore_seller)
|| (int)$bookstore_seller->id <= 0
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/editbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function postProcess()
}
// Secure also on submit AND getting customer id
$bookstore_seller = EverPsBookstoreSeller::getBookstoreSellerByCustomerId(
(int)Tools::getValue('id_bookstore_seller')
(int)Context::getContext()->customer->id
);
if (!Validate::isLoadedObject($bookstore_seller)
|| (int)$bookstore_seller->id <= 0
Expand Down
3 changes: 2 additions & 1 deletion everpsbookstore.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct()
{
$this->name = 'everpsbookstore';
$this->tab = 'others';
$this->version = '2.1.4';
$this->version = '2.1.5';
$this->author = 'Team Ever';
$this->need_instance = 0;
$this->bootstrap = true;
Expand Down Expand Up @@ -560,6 +560,7 @@ protected function postProcess()
EverPsBookstoreSeller::cleanBookstoreSellers(
(int)Context::getContext()->shop->id
);
Tools::clearAllCache();
}

/**
Expand Down

0 comments on commit e91deb9

Please sign in to comment.