Skip to content
Permalink
Browse files

Disabled CSRF for `add-to-cart-dedicated` action, chenged Configs fin…

…d for ServerOrderDedicatedProduct (#126)
  • Loading branch information...
tafid authored and SilverFire committed Jul 19, 2019
1 parent e11301d commit 78c2e1cf7bf287170e155f5b7ff96552dae7b053
Showing with 12 additions and 3 deletions.
  1. +3 −3 src/cart/ServerOrderDedicatedProduct.php
  2. +9 −0 src/controllers/OrderController.php
@@ -85,11 +85,11 @@ public function load($data, $formName = null)
/** {@inheritdoc} */
protected function ensureRelatedData()
{
$configs = Config::find(['batch' => true])->getAvailable()->withSellerOptions()->andWhere(['id' => $this->object_id])->all();
if (empty($configs)) {
$config = Config::find()->where(['id' => $this->object_id])->one();
if (empty($config)) {
throw new InvalidConfigException('Failed to find config');
}
$this->_model = reset($configs);
$this->_model = $config;
$this->_image = Osimage::find()->where(['osimage' => $this->osimage, 'type' => 'dedicated'])->one();
if ($this->_image === null) {
@@ -58,6 +58,15 @@ public function behaviors()
]);
}
public function beforeAction($action)
{
if ($action->id == 'add-to-cart-dedicated') {
$this->enableCsrfValidation = false;
}
return parent::beforeAction($action);
}
public function actions()
{
return [

0 comments on commit 78c2e1c

Please sign in to comment.
You can’t perform that action at this time.