| Total Complexity | 7 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class PasswordResetRequest extends Model |
||
| 13 | { |
||
| 14 | public $email; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @inheritdoc |
||
| 18 | */ |
||
| 19 | public function rules() |
||
| 20 | { |
||
| 21 | $class = Yii::$app->getUser()->identityClass ? : 'toir427\admin\models\User'; |
||
| 22 | return [ |
||
| 23 | ['email', 'filter', 'filter' => 'trim'], |
||
| 24 | ['email', 'required'], |
||
| 25 | ['email', 'email'], |
||
| 26 | ['email', 'exist', |
||
| 27 | 'targetClass' => $class, |
||
| 28 | 'filter' => ['status' => UserStatus::ACTIVE], |
||
| 29 | 'message' => 'There is no user with such email.' |
||
| 30 | ], |
||
| 31 | ]; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Sends an email with a link, for resetting the password. |
||
| 36 | * |
||
| 37 | * @return boolean whether the email was send |
||
| 38 | */ |
||
| 39 | public function sendEmail() |
||
| 63 | } |
||
| 64 | } |
||
| 65 |