1 | <?php |
||
11 | class PasswordResetRequestForm extends \yii\base\Model |
||
12 | { |
||
13 | /** |
||
14 | * @var string |
||
15 | */ |
||
16 | public $email; |
||
17 | |||
18 | /** |
||
19 | * @inheritdoc |
||
20 | */ |
||
21 | 14 | public function rules() |
|
22 | { |
||
23 | return [ |
||
24 | 14 | ['email', 'filter', 'filter' => 'trim'], |
|
25 | ['email', 'required'], |
||
26 | ['email', 'email'], |
||
27 | 14 | ['email', 'exist', |
|
28 | 14 | 'targetClass' => '\app\models\entity\User', |
|
29 | 'filter' => ['status' => User::STATUS_ACTIVE], |
||
30 | 14 | 'message' => Yii::t('app.msg', 'There is no user with such email') |
|
31 | ], |
||
32 | ]; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @inheritdoc |
||
37 | */ |
||
38 | 12 | public function attributeLabels() |
|
44 | |||
45 | /** |
||
46 | * Sends an email with a link, for resetting the password |
||
47 | * |
||
48 | * @throws Exception |
||
49 | * @throws UserException |
||
50 | */ |
||
51 | 6 | public function sendEmail(): void |
|
78 | } |
||
79 |