public function run($token)
    {
        try {
            $model = Yii::createObject($this->modelClass, [$token]);
            $event = $this->getFormEvent($model);
            $this->trigger(self::EVENT_BEFORE_RESET, $event);
        } catch (InvalidParamException $e) {
            throw new BadRequestHttpException($e->getMessage());
        }

        if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
            $this->trigger(self::EVENT_AFTER_RESET, $event);
            Yii::$app->getSession()->setFlash('success', $this->successMessage);

            return $this->redirectTo(Yii::$app->getHomeUrl());
        }

        return $this->controller->render($this->view, [
            'model' => $model,
        ]);
    }
public function run($token)
    {
        try {
            $model = Yii::createObject($this->modelClass, [$token]);
            $event = $this->getFormEvent($model);
            $this->trigger(self::EVENT_BEFORE_RESET, $event);
        } catch (InvalidParamException $e) {
            throw new BadRequestHttpException($e->getMessage());
        }

        if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
            $this->trigger(self::EVENT_AFTER_RESET, $event);
            Yii::$app->getSession()->setFlash('success', $this->successMessage);

            return $this->redirectTo(Yii::$app->getHomeUrl());
        }

        return $this->controller->render($this->view, [
            'model' => $model,
        ]);
    }
public function run ( $ token ) { try { $ model = Yii :: createObject ( $ this -> modelClass , [ $ token ] ) ; $ event = $ this -> getFormEvent ( $ model ) ; $ this -> trigger ( self :: EVENT_BEFORE_RESET , $ event ) ; } catch ( InvalidParamException $ e ) { throw new BadRequestHttpException ( $ e -> getMessage ( ) ) ; } if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> validate ( ) && $ model -> resetPassword ( ) ) { $ this -> trigger ( self :: EVENT_AFTER_RESET , $ event ) ; Yii :: $ app -> getSession ( ) -> setFlash ( 'success' , $ this -> successMessage ) ; return $ this -> redirectTo ( Yii :: $ app -> getHomeUrl ( ) ) ; } return $ this -> controller -> render ( $ this -> view , [ 'model' => $ model , ] ) ; }
Reset password for a user.

@param $token

@return string|\yii\web\Response

@throws \yii\web\BadRequestHttpException
Reset password for a user .