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