Bläddra i källkod

Correctif

refactoring
Guillaume Bourgeois 1 år sedan
förälder
incheckning
aa4705beba
2 ändrade filer med 5 tillägg och 3 borttagningar
  1. +1
    -1
      common/logic/User/User/Service/UserSolver.php
  2. +4
    -2
      frontend/forms/PasswordResetRequestForm.php

+ 1
- 1
common/logic/User/User/Service/UserSolver.php Visa fil

@@ -75,7 +75,7 @@ class UserSolver extends AbstractService implements SolverInterface
* @param string $token password reset token
* @return boolean
*/
public static function isPasswordResetTokenValid($token)
public function isPasswordResetTokenValid($token)
{
if (empty($token)) {
return false;

+ 4
- 2
frontend/forms/PasswordResetRequestForm.php Visa fil

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

use common\logic\User\User\Model\User;
use common\logic\User\User\Service\UserSolver;
use common\logic\User\User\Wrapper\UserManager;
use yii\base\Model;
use yii;

@@ -73,13 +74,14 @@ class PasswordResetRequestForm extends Model
*/
public function sendEmail()
{
$userManager = UserManager::getInstance();
$user = User::findOne([
'email' => $this->email,
]);

if ($user) {
if (!UserSolver::isPasswordResetTokenValid($user->password_reset_token)) {
$user->generatePasswordResetToken();
if (!$userManager->isPasswordResetTokenValid($user->password_reset_token)) {
$userManager->generatePasswordResetToken($user);
}

if ($user->save()) {

Laddar…
Avbryt
Spara