<commit_before><?php

class Denkmal_Form_User extends \CM_Form_Abstract {

    protected function _initialize() {
        $this->registerField(new CM_FormField_Email(['name' => 'email']));
        $this->registerField(new CM_FormField_Text(['name' => 'username']));
        $this->registerField(new CM_FormField_Password(['name' => 'password']));

        $this->registerAction(new Denkmal_FormAction_User_Create($this));
        $this->registerAction(new Denkmal_FormAction_User_Save($this));
    }

    public function prepare(CM_Frontend_Environment $environment, CM_Frontend_ViewResponse $viewResponse) {
        /** @var Denkmal_Params $params */
        $params = $this->getParams();

        if ($params->has('user')) {
            $user = $params->getUser('user');
            $this->getField('email')->setValue($user->getEmail());
            $this->getField('username')->setValue($user->getUsername());
        }
    }
}<commit_msg>Limit username length on form<commit_after><?php

class Denkmal_Form_User extends \CM_Form_Abstract {

    protected function _initialize() {
        $this->registerField(new CM_FormField_Email(['name' => 'email']));
        $this->registerField(new CM_FormField_Text(['name' => 'username', 'lengthMin' => 2, 'lengthMax' => 15]));
        $this->registerField(new CM_FormField_Password(['name' => 'password']));

        $this->registerAction(new Denkmal_FormAction_User_Create($this));
        $this->registerAction(new Denkmal_FormAction_User_Save($this));
    }

    public function prepare(CM_Frontend_Environment $environment, CM_Frontend_ViewResponse $viewResponse) {
        /** @var Denkmal_Params $params */
        $params = $this->getParams();

        if ($params->has('user')) {
            $user = $params->getUser('user');
            $this->getField('email')->setValue($user->getEmail());
            $this->getField('username')->setValue($user->getUsername());
        }
    }
}
{'fraction_non_alphanumeric': 0.16520392359318534, 'fraction_numerical': 0.0015487867836861124, 'mean_word_length': 3.7616707616707616, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6123082', 'n_tokens_mistral': 565, 'n_tokens_neox': 558, 'n_words': 84}