Просмотр исходного кода

Merge tag 'hotfix_1227' into develop

hotfix_1227
feature/souke
Guillaume Bourgeois 1 год назад
Родитель
Сommit
9b927d1df4
3 измененных файлов: 15 добавлений и 4 удалений
  1. +1
    -1
      frontend/controllers/SiteController.php
  2. +1
    -3
      frontend/views/site/producer.php
  3. +13
    -0
      producer/controllers/NewsletterController.php

+ 1
- 1
frontend/controllers/SiteController.php Просмотреть файл

@@ -460,7 +460,7 @@ class SiteController extends FrontendController
$loginForm->id_producer = $id;
$signupForm->id_producer = $id;
$signupForm->option_user_producer = 'user';
$returnUrl = $this->getRequest()->get('returnUrl', $this->getUrlManagerProducer()->createAbsoluteUrl(['site/index', 'slug_producer' => $producer->slug]));
$returnUrl = $this->getRequest()->get('return_url', $this->getUrlManagerProducer()->createAbsoluteUrl(['site/index', 'slug_producer' => $producer->slug]));

if (Yii::$app->user->isGuest) {
if ($loginForm->load($this->getRequest()->post()) && $loginForm->login()) {

+ 1
- 3
frontend/views/site/producer.php Просмотреть файл

@@ -49,11 +49,9 @@ $this->setMeta('description', 'Veuillez vous connecter pour réserver les produi
?>

<div id="page-producer">

<div class="alert alert-warning">
Veuillez vous identifier pour commander vos produits sur l'espace du producteur <strong><?= Html::encode($producer->name); ?></strong>.
Veuillez vous identifier pour accéder à l'espace du producteur <strong><?= Html::encode($producer->name); ?></strong>.
</div>

<div class="col-md-6">
<div class="panel panel-primary">
<div class="panel-heading">

+ 13
- 0
producer/controllers/NewsletterController.php Просмотреть файл

@@ -67,6 +67,10 @@ class NewsletterController extends ProducerBaseController

public function actionSubscribe()
{
if(!$this->getUserCurrent()) {
return $this->redirectProducerLoginFrontend('subscribe');
}

$userManager = $this->getUserManager();
$userCurrent = $this->getUserCurrent();
$userManager->subscribeUserNewsletter($userCurrent);
@@ -76,12 +80,21 @@ class NewsletterController extends ProducerBaseController

public function actionUnsubscribe()
{
if(!$this->getUserCurrent()) {
return $this->redirectProducerLoginFrontend('unsubscribe');
}

$userManager = $this->getUserManager();
$userCurrent = $this->getUserCurrent();
$userManager->unsubscribeUserNewsletter($userCurrent);
$this->setFlash('success', "À partir de maintenant, vous ne recevrez plus d'email de la part de ce producteur.");
return $this->redirect('index');
}

public function redirectProducerLoginFrontend(string $actionNewsletter)
{
return $this->redirect($this->getUrlManagerFrontend()->createAbsoluteUrl(['site/producer', 'id' => $this->getProducerCurrent()->id, 'return_url' => \Yii::$app->urlManagerProducer->createAbsoluteUrl(['newsletter/'.$actionNewsletter, 'slug_producer' => $this->getProducerCurrent()->slug])]));
}
}

?>

Загрузка…
Отмена
Сохранить