Commit 462ce364e59a4fdacd0a07862525087121c0e3d2
1 parent
57e7caa3
restet password mail
Showing
3 changed files
with
22 additions
and
1 deletions
Show diff stats
common/models/Customer.php
1 | +<?php | |
2 | +use yii\helpers\Html; | |
3 | + | |
4 | +/* @var $this yii\web\View */ | |
5 | +/* @var $user common\models\User */ | |
6 | + | |
7 | +$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]); | |
8 | +?> | |
9 | +<div class="password-reset"> | |
10 | + <p>Hello <?= Html::encode($user->username) ?>,</p> | |
11 | + | |
12 | + <p>Follow the link below to reset your password:</p> | |
13 | + | |
14 | + <p><?= Html::a(Html::encode($resetLink), $resetLink) ?></p> | |
15 | +</div> | |
0 | 16 | \ No newline at end of file | ... | ... |
frontend/controllers/LoginController.php
... | ... | @@ -38,6 +38,12 @@ class LoginController extends Controller |
38 | 38 | $model = new Customer; |
39 | 39 | if(!empty($_POST['Customer']['username'])){ |
40 | 40 | if($user = Customer::find()->where(['username'=>$_POST['Customer']['username']])->one()) |
41 | + Mailer::widget( | |
42 | + ['type' => 'password', | |
43 | + 'subject'=> 'Ваш пароль', | |
44 | + 'email' => $user->email, | |
45 | + 'params' => $user, | |
46 | + ]); | |
41 | 47 | $user->sendMsg(); |
42 | 48 | Yii::$app->getSession()->setFlash('success', 'На указанный Вами эмейл отправленно письмо с паролем!'); |
43 | 49 | return $this->refresh(); | ... | ... |