소스 검색

Fix bug de connexion sous chrome

dev
부모
커밋
a8e853509e
5개의 변경된 파일28개의 추가작업 그리고 35개의 파일을 삭제
  1. +4
    -2
      common/config/main.php
  2. +1
    -1
      common/models/User.php
  3. +2
    -2
      frontend/controllers/SiteController.php
  4. +20
    -29
      frontend/models/SignupForm.php
  5. +1
    -1
      vendor/yiisoft/yii2/web/User.php

+ 4
- 2
common/config/main.php 파일 보기

@@ -36,6 +36,8 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

$serverName = $_SERVER['SERVER_NAME'] ;

return [
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [
@@ -45,7 +47,7 @@ return [
'enableAutoLogin' => true,
'identityCookie' => [
'name' => 'laboiteapain',
'domain' => '.'.Yii::getAlias('@domainName'),
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'),
'path' => '/',
]
],
@@ -53,7 +55,7 @@ return [
'class' => 'yii\web\Session',
'name' => 'PHPLABOITEAPAINSESSID',
'cookieParams' => [
'domain' => '.'.Yii::getAlias('@domainName'),
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'),
'httpOnly' => true,
],
],

+ 1
- 1
common/models/User.php 파일 보기

@@ -292,7 +292,7 @@ class User extends ActiveRecordCommon implements IdentityInterface
}
$query = (new Query())
->select(['user.id AS user_id', 'user.name', 'user.lastname', 'user.phone', 'user.email', 'user.created_at', 'user.date_last_connection', 'user_producer.*'])
->select(['user.id AS user_id', 'user.name', 'user.lastname', 'user.phone', 'user.email', 'user.created_at', 'CAST(FROM_UNIXTIME(user.created_at) AS date) as date_created_at','user.date_last_connection', 'user_producer.*'])
->from('user');
$active = (isset($params['inactive']) && $params['inactive']) ? 0 : 1 ;

+ 2
- 2
frontend/controllers/SiteController.php 파일 보기

@@ -65,7 +65,7 @@ use dosamigos\leaflet\widgets\Map;
*/
class SiteController extends FrontendController
{
/**
* @inheritdoc
*/
@@ -179,7 +179,7 @@ class SiteController extends FrontendController
public function actionLogin()
{
if (!\Yii::$app->user->isGuest) {
return Yii::$app->getResponse()->redirect(['order/index']);
return Yii::$app->getResponse()->redirect(['site/index']);
}

$model = new LoginForm();

+ 20
- 29
frontend/models/SignupForm.php 파일 보기

@@ -260,42 +260,33 @@ class SignupForm extends Model

$user->setPassword($this->password);
$user->generateAuthKey();
if ($user->save()) {

// on ajoute l'établissement sélectionnée par l'user en favoris
if ($this->option_user_producer == 'user') {
if ($this->id_producer) {
$producer = Producer::find()->where(['id' => $this->id_producer])->one();
if ($producer) {
Producer::addUser($user->id, $this->id_producer) ;
if ($this->option_user_producer == 'user' && $this->id_producer) {
$producer = Producer::find()->where(['id' => $this->id_producer])->one();

// envoi d'un email à l'utilisateur
Yii::$app->mailer->compose(
[
'html' => 'signup-html',
'text' => 'signup-text'
],
[
'user' => $user,
'producer' => $producer
])
->setTo($user->email)
->setFrom([Yii::$app->params['adminEmail'] => 'La boîte à pain'])
->setSubject('[La boîte à pain] Inscription')
->send();
}
if ($producer) {
Producer::addUser($user->id, $this->id_producer) ;

// envoi d'un email à l'utilisateur
Yii::$app->mailer->compose(
[
'html' => 'signup-html',
'text' => 'signup-text'
],
[
'user' => $user,
'producer' => $producer
])
->setTo($user->email)
->setFrom([Yii::$app->params['adminEmail'] => 'La boîte à pain'])
->setSubject('[La boîte à pain] Inscription')
->send();
}
}

if ($this->option_user_producer == 'user') {
$userProducer = new UserProducer;
$userProducer->id_producer = $producer->id;
$userProducer->id_user = $user->id;
$userProducer->credit = 0;
$userProducer->active = 1;
$userProducer->save();
}

return $user;
}
}

+ 1
- 1
vendor/yiisoft/yii2/web/User.php 파일 보기

@@ -256,7 +256,7 @@ class User extends Component
Yii::info($log, __METHOD__);
$this->afterLogin($identity, false, $duration);
}
return !$this->getIsGuest();
}


Loading…
취소
저장