Kaynağa Gözat

[frontend] Compte démo : lien vers compte de démo + affichage des identifiants sur la page de connexion

refactoring
Guillaume Bourgeois 5 yıl önce
ebeveyn
işleme
95f6f01bc7
6 değiştirilmiş dosya ile 38 ekleme ve 9 silme
  1. +1
    -1
      backend/views/site/login.php
  2. +25
    -0
      common/models/Producer.php
  3. +3
    -1
      frontend/controllers/SiteController.php
  4. +1
    -0
      frontend/views/site/index.php
  5. +0
    -7
      frontend/views/site/login.php
  6. +8
    -0
      frontend/views/site/producer.php

+ 1
- 1
backend/views/site/login.php Dosyayı Görüntüle

@@ -63,7 +63,7 @@ $fieldOptions2 = [
</div>
<!-- /.login-logo -->
<div class="login-box-body">
<?php $form = ActiveForm::begin(['id' => 'login-form', 'enableClientValidation' => false]); ?>

<?= $form

+ 25
- 0
common/models/Producer.php Dosyayı Görüntüle

@@ -489,5 +489,30 @@ class Producer extends ActiveRecordCommon
return '' ;
}
/**
* Retourne le compte producteur de démonstration.
*
* @return Producer
*/
public static function getDemoAccount()
{
$producer = Producer::find()->where('name LIKE \'Démo\'')->one() ;
return $producer ;
}
/**
* Retourne true si le compte est un compte de démo.
*
* @return boolean
*/
public function isDemo()
{
if(strpos($this->name, 'Démo') !== false) {
return true ;
}
return false ;
}
}

+ 3
- 1
frontend/controllers/SiteController.php Dosyayı Görüntüle

@@ -135,7 +135,9 @@ class SiteController extends FrontendController
*/
public function actionIndex()
{
return $this->render('index');
return $this->render('index', [
'producerDemoAccount' => Producer::getDemoAccount()
]);
}
/**

+ 1
- 0
frontend/views/site/index.php Dosyayı Görüntüle

@@ -71,6 +71,7 @@ $this->setTitle('Logiciel libre de distribution alimentaire') ;
<div class="panel-body">
<p class="presentation">Simplifiez la distribution de vos produits<br /> avec des outils adaptés.</p>
<a class="btn btn-primary" href="<?= Yii::$app->urlManagerFrontend->createUrl(['site/signup']) ; ?>"><span class="glyphicon glyphicon-user"></span> Je crée mon espace</a>
<?php if($producerDemoAccount) : ?><a class="btn btn-default" href="<?= Yii::$app->urlManagerFrontend->createUrl(['site/producer', 'id' => $producerDemoAccount->id]) ; ?>"><span class="glyphicon glyphicon-blackboard"></span> Démonstration</a><?php endif; ?>
<a class="btn btn-default" href="<?= Yii::$app->urlManagerFrontend->createUrl(['site/contact']) ; ?>"><span class="glyphicon glyphicon-info-sign"></span> Demande d'informations</a>
</div>
</div>

+ 0
- 7
frontend/views/site/login.php Dosyayı Görüntüle

@@ -54,13 +54,6 @@ $this->params['breadcrumbs'][] = $this->title;
<div class="col-lg-5">
<p>Pas encore de compte ? <a class="" href="<?php echo Yii::$app->urlManager->createUrl('site/signup') ; ?>">Je m'inscris</a></p>
<?php if(YII_ENV == 'demo') : ?>
<div class="alert alert-warning">
Identifiant : <strong>producer@laboiteapain.net</strong><br />
Mot de passe : <strong>laboiteapain</strong>
</div>
<?php endif; ?>
<?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
<?= $form->field($model, 'email') ?>
<?= $form->field($model, 'password')->passwordInput() ?>

+ 8
- 0
frontend/views/site/producer.php Dosyayı Görüntüle

@@ -53,6 +53,14 @@ $this->title = 'Producteur '.Html::encode($producer->name) ;
<div class="col-md-6">
<h2>Connexion</h2>
<?php if(isset($producer) && $producer->isDemo()) : ?>
<div class="alert alert-warning">
<p>Merci d'utiliser les identifiants suivants pour vous connecter à l'espace de démonstration :</p>
Identifiant : <strong>demo@opendistrib.net</strong><br />
Mot de passe : <strong>opendistrib</strong>
</div>
<?php endif; ?>
<?php $form = ActiveForm::begin(['id' => 'login-form','enableClientValidation'=> false]); ?>
<?= $form->field($loginForm, 'email') ?>
<?= $form->field($loginForm, 'password')->passwordInput() ?>

Yükleniyor…
İptal
Kaydet