public function actionConfirm($token)
    {
        $user = $this->module->model('User');
        $user = $this->findModel([
            'auth_key' => $token,
            'status' => $user::STATUS_REGISTERED,
        ]);

        if (empty($user)) {
            Yii::$app->session->setFlash('error',
                Yii::t($this->tcModule, 'Such unconfirmed user not found or already confirmed.')
                . ' ' . Yii::t($this->tcModule, 'Try to login or signup again.')
            );
            return $this->redirect(['login']);
        }

        if ($this->confirmExpireDays) {
            $confirmExpirePeriod = 60 * 60 * 24 * $this->confirmExpireDays;
            if (time() > ($user->created_at + $confirmExpirePeriod)) {
                $user->delete();
                Yii::$app->session->setFlash('error', Yii::t($this->tcModule, 'Token expired please register again.'));
                return $this->redirect(['signup']);
            }
        }

        $user->status = $this->waitModeration ? $user::STATUS_WAIT : $user::STATUS_ACTIVE;
        $user->auth_key = $user->generateAuthKey();
        $result = $user->save();
        if ($result) {
            $msg = Yii::t($this->tcModule, 'Registration confirmed.');
            if ($this->waitModeration) {
                $msg .= ' ' . Yii::t($this->tcModule, 'Wait moderation.');
            }
            Yii::$app->session->setFlash('success', $msg);
        } else {
            $msg = Yii::t($this->tcModule, 'User registration confirmation error.');
            Yii::trace($msg . ' ' . var_export($user->errors, true) . ' ' . var_export($user->attributes, true));
            Yii::$app->session->setFlash('error', $msg . ' ' . Yii::t($this->tcModule, 'Apply to support.'));
        }

        return $this->goHome();
    }