Bladeren bron

Correctif

refactoring
Guillaume Bourgeois 1 jaar geleden
bovenliggende
commit
aa4705beba
2 gewijzigde bestanden met toevoegingen van 5 en 3 verwijderingen
  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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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()) {

Laden…
Annuleren
Opslaan