public function actionCancel()
    {
        /** @var \amnah\yii2\user\models\User $user */
        /** @var \amnah\yii2\user\models\UserToken $userToken */

        // find userToken of type email change
        $user = Yii::$app->user->identity;
        $userToken = $this->module->model("UserToken");
        $userToken = $userToken::findByUser($user->id, $userToken::TYPE_EMAIL_CHANGE);
        if ($userToken) {
            $userToken->delete();
            Yii::$app->session->setFlash("Cancel-success", Yii::t("user", "Email change cancelled"));
        }

        return $this->redirect(["/user/account"]);
    }
public function actionCancel()
    {
        /** @var \amnah\yii2\user\models\User $user */
        /** @var \amnah\yii2\user\models\UserToken $userToken */

        // find userToken of type email change
        $user = Yii::$app->user->identity;
        $userToken = $this->module->model("UserToken");
        $userToken = $userToken::findByUser($user->id, $userToken::TYPE_EMAIL_CHANGE);
        if ($userToken) {
            $userToken->delete();
            Yii::$app->session->setFlash("Cancel-success", Yii::t("user", "Email change cancelled"));
        }

        return $this->redirect(["/user/account"]);
    }
public function actionCancel ( ) { /** @var \amnah\yii2\user\models\User $user */ /** @var \amnah\yii2\user\models\UserToken $userToken */ // find userToken of type email change $ user = Yii :: $ app -> user -> identity ; $ userToken = $ this -> module -> model ( "UserToken" ) ; $ userToken = $ userToken :: findByUser ( $ user -> id , $ userToken :: TYPE_EMAIL_CHANGE ) ; if ( $ userToken ) { $ userToken -> delete ( ) ; Yii :: $ app -> session -> setFlash ( "Cancel-success" , Yii :: t ( "user" , "Email change cancelled" ) ) ; } return $ this -> redirect ( [ "/user/account" ] ) ; }
Cancel email change
Cancel email change