Skip to content

Commit

Permalink
appfront favorite and review csrf
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyecommerce committed Nov 28, 2018
1 parent 6ae709c commit caf1eee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Expand Up @@ -17,6 +17,7 @@
*/
class FavoriteproductController extends AppfrontController
{
public $enableCsrfValidation = true;
// 增加收藏
public function actionAdd()
{
Expand Down
Expand Up @@ -18,6 +18,8 @@
*/
class ReviewproductController extends AppfrontController
{
public $enableCsrfValidation = true;

public function init()
{
parent::init();
Expand All @@ -37,22 +39,21 @@ public function actionAdd()
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
$editForm = Yii::$app->request->post('editForm');
$editForm = \Yii::$service->helper->htmlEncode($editForm);
$editForm = Yii::$service->helper->htmlEncode($editForm);
if (!empty($editForm) && is_array($editForm)) {
$saveStatus = $this->getBlock()->saveReview($editForm);
if ($saveStatus) {
$spu = Yii::$app->request->get('spu');
$_id = Yii::$app->request->get('_id');
$spu = \Yii::$service->helper->htmlEncode($spu);
$_id = \Yii::$service->helper->htmlEncode($_id);
$spu = Yii::$service->helper->htmlEncode($spu);
$_id = Yii::$service->helper->htmlEncode($_id);
if ($spu && $_id) {
$url = Yii::$service->url->getUrl('catalog/reviewproduct/lists', ['spu' => $spu, '_id'=>$_id]);
return $this->redirect($url);

}
}
}
//echo 1;exit;
$data = $this->getBlock()->getLastData($editForm);

return $this->render($this->action->id, $data);
Expand Down

0 comments on commit caf1eee

Please sign in to comment.