소스 검색

[Site] Mot de passe oublié : correctif envoi impossible de l'email avec lien de réinitialisation

feature/rotating_product
Guillaume Bourgeois 6 달 전
부모
커밋
f2a394cf13
3개의 변경된 파일12개의 추가작업 그리고 14개의 파일을 삭제
  1. +2
    -7
      common/forms/LoginForm.php
  2. +7
    -3
      domain/User/User/UserRepository.php
  3. +3
    -4
      frontend/forms/PasswordResetRequestForm.php

+ 2
- 7
common/forms/LoginForm.php 파일 보기

@@ -40,6 +40,7 @@ namespace common\forms;

use domain\Producer\Producer\Producer;
use domain\User\User\User;
use domain\User\User\UserRepository;
use Yii;
use yii\base\Model;

@@ -122,13 +123,7 @@ class LoginForm extends Model
public function getUser(): ?User
{
if ($this->_user === false) {
$this->_user = User::searchOne(
['email' => $this->email],
[
'conditions' => 'type LIKE :type_individual OR type LIKE :type_legal_person',
'params' => [':type_individual' => User::TYPE_INDIVIDUAL, ':type_legal_person' => User::TYPE_LEGAL_PERSON]
]
);
$this->_user = UserRepository::getInstance()->findOneUserByEmail($this->email);
}

return $this->_user;

+ 7
- 3
domain/User/User/UserRepository.php 파일 보기

@@ -213,9 +213,13 @@ class UserRepository extends AbstractRepository
*/
public function findOneUserByEmail(string $email): ?User
{
return $this->createDefaultQuery()
->filterByEmail($email)
->findOne();
return User::searchOne(
['email' => $email],
[
'conditions' => 'type LIKE :type_individual OR type LIKE :type_legal_person',
'params' => [':type_individual' => User::TYPE_INDIVIDUAL, ':type_legal_person' => User::TYPE_LEGAL_PERSON]
]
);
}

public function findOneUserByUsername(string $username): ?User

+ 3
- 4
frontend/forms/PasswordResetRequestForm.php 파일 보기

@@ -40,6 +40,7 @@ namespace frontend\forms;

use domain\User\User\User;
use domain\User\User\UserModule;
use domain\User\User\UserRepository;
use yii\base\Model;

/**
@@ -70,12 +71,10 @@ class PasswordResetRequestForm extends Model
*
* @return boolean whether the email was send
*/
public function sendEmail()
public function sendEmail()
{
$userModule = UserModule::getInstance();
$user = User::findOne([
'email' => $this->email,
]);
$user = $userModule->getRepository()->findOneUserByEmail($this->email);

if ($user) {
if (!$userModule->isPasswordResetTokenValid($user->password_reset_token)) {

Loading…
취소
저장