| Conditions | 6 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function run($token) |
||
| 21 | { |
||
| 22 | $resetPasswordFormClass = Yii::$app->get('auth')->modelMap['resetPasswordForm']['class']; |
||
| 23 | |||
| 24 | Event::trigger(self::class, static::EVENT_BEFORE_RESET_PASSWORD, new ResetPasswordEvent($this, $token, ['sender' => $this])); |
||
| 25 | try { |
||
| 26 | $model = new $resetPasswordFormClass($token); |
||
| 27 | } catch (InvalidParamException $e) { |
||
| 28 | Event::trigger(self::class, static::EVENT_ERROR_RESET_PASSWORD, new ResetPasswordErrorEvent($this, $token, $e, ['sender' => $this])); |
||
| 29 | } |
||
| 30 | |||
| 31 | if ($model instanceof $resetPasswordFormClass && |
||
| 32 | $model->load(Yii::$app->request->post()) && |
||
| 33 | $model->validate() && |
||
| 34 | $model->resetPassword() |
||
| 35 | ) { |
||
| 36 | Event::trigger(self::class, static::EVENT_AFTER_RESET_PASSWORD, new ResetPasswordEvent($this, $model, ['sender' => $this])); |
||
| 37 | } |
||
| 38 | |||
| 39 | return $this->controller->render($this->view, [ |
||
| 40 | 'model' => $model, |
||
| 41 | ]); |
||
| 42 | } |
||
| 43 | } |
||
| 44 |