<commit_before><?php
class Vpc_User_Activate_Form_Component extends Vpc_Form_Component
{
    private $_user = null;
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['placeholder']['submitButton'] = trlVps('Activate Account');
        $ret['generators']['child']['component']['success'] = 'Vpc_User_Activate_Form_Success_Component';
        return $ret;
    }

    protected function _initForm()
    {
        parent::_initForm();
        $this->_form->setModel(new Vps_Model_FnF());
        $this->_form->add(new Vps_Form_Field_Hidden('code'));
    }

    
    public function processInput(array $postData)
    {
        parent::processInput($postData);

        if (isset($postData['code'])) {
            $code = $postData['code'];
            $this->_form->getRow()->code = $code;
        } else {
            $code = $this->_form->getRow()->code;
        }

        list($userId, $code) = explode('-', $code);
        if (empty($userId) || empty($code)) {
            $this->_errors[] = trlVps('Data was not sent completely. Please copy the complete address out of the email.');
        }
        $userId = (int)$userId;
        $this->_user = Zend_Registry::get('userModel')->find($userId)->current();

        if (!$this->_user) {
            $this->_errors[] = trlVps('User ID ist invalid.');
        } else if ($this->_user->getActivationCode() != $code) {
            $this->_errors[] = trlVps('Activation code is wrong. Eventually your account has already been activated, or the address was copied wrong out of the email.');
        }

        Vps_Auth::getInstance()->clearIdentity();

        if ($this->_user && $this->isSaved()) {
            $this->_user->setPassword($this->_form->getRow()->password);
            $auth = Vps_Auth::getInstance();
            $auth->getStorage()->write(array('userId' => $this->_user->id));
        }
    }
}<commit_msg>fehlerbehandlung bei ungültigen aktivierungs-links verbessert<commit_after><?php
class Vpc_User_Activate_Form_Component extends Vpc_Form_Component
{
    private $_user = null;
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['placeholder']['submitButton'] = trlVps('Activate Account');
        $ret['generators']['child']['component']['success'] = 'Vpc_User_Activate_Form_Success_Component';
        return $ret;
    }

    protected function _initForm()
    {
        parent::_initForm();
        $this->_form->setModel(new Vps_Model_FnF());
        $this->_form->add(new Vps_Form_Field_Hidden('code'));
    }

    
    public function processInput(array $postData)
    {
        parent::processInput($postData);

        if (isset($postData['code'])) {
            $code = $postData['code'];
            $this->_form->getRow()->code = $code;
        } else {
            $code = $this->_form->getRow()->code;
        }
        $code = explode('-', $code);
        if (count($code) != 2 || empty($code[0]) || empty($code[1])) {
            $this->_errors[] = trlVps('Data was not sent completely. Please copy the complete address out of the email.');
        } else {
            $userId = (int)$code[0];
            $code = $code[1];
            $this->_user = Zend_Registry::get('userModel')->find($userId)->current();
            if (!$this->_user) {
                $this->_errors[] = trlVps('Data was not sent completely. Please copy the complete address out of the email.');
            } else if ($this->_user->getActivationCode() != $code) {
                $this->_errors[] = trlVps('Activation code is wrong. Eventually your account has already been activated, or the address was copied wrong out of the email.');
            }
        }

        Vps_Auth::getInstance()->clearIdentity();

        if ($this->_user && $this->isSaved()) {
            $this->_user->setPassword($this->_form->getRow()->password);
            $auth = Vps_Auth::getInstance();
            $auth->getStorage()->write(array('userId' => $this->_user->id));
        }
    }
}
{'fraction_non_alphanumeric': 0.16708043694141012, 'fraction_numerical': 0.0012413108242303873, 'mean_word_length': 2.616696588868941, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 67, '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': '6870386', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1153, 'n_words': 240}