public function createFormModel($class, $scenario = null)
    {
        $namespacedClass = "\\nineinchnick\\usr\\models\\{$class}";
        /** @var Model */
        $form = new $namespacedClass();
        if ($scenario !== null) {
            $form->setScenario($scenario);
        }
        if ($form instanceof \nineinchnick\usr\models\BaseUsrForm) {
            $form->webUser = Yii::$app->user;
        }
        if ($form instanceof \nineinchnick\usr\models\BasePasswordForm) {
            $form->passwordStrengthRules = $this->passwordStrengthRules;
        }
        switch ($class) {
            default:
                break;
            case 'ProfileForm':
                $form->pictureUploadRules = $this->pictureUploadRules;
                if (!empty($this->profileFormBehaviors)) {
                    foreach ($this->profileFormBehaviors as $name => $config) {
                        $form->attachBehavior($name, $config);
                    }
                }
                // no break
            case 'RecoveryForm':
                if ($this->captcha !== null && \yii\captcha\Captcha::checkRequirements()) {
                    $form->attachBehavior('captcha', [
                        'class' => 'nineinchnick\usr\components\CaptchaFormBehavior',
                        'ruleOptions' => $class == 'ProfileForm'
                            ? ['on' => 'register']
                            : ['except' => ['reset', 'verify']],
                    ]);
                }
                break;
            case 'LoginForm':
                if ($this->loginFormBehaviors !== null && is_array($this->loginFormBehaviors)) {
                    foreach ($this->loginFormBehaviors as $name => $config) {
                        $form->attachBehavior($name, $config);
                    }
                }
                break;
            case 'AuthForm':
                $form->setValidProviders(array_keys(Yii::$app->get('authClientCollection')->clients));
                break;
        }

        return $form;
    }