<commit_before><?php
class page_bootstrap extends Page {
	function init() {
		parent::init ();
		$model = $this->add ( 'Model_Account' );
		
		if ($model->count ()->getOne () > 0) {
			throw $this->exception ( 'Init reeds gebeurd' );
		}
		
		$form = $this->add ( 'MVCForm' );
		$form->setModel ( $model );
		$form->addField ( 'password', '<PASSWORD>' )->isMandatory ( true );
		$form->addField ( 'password', '<PASSWORD>' )->isMandatory ( true );
		$form->addSubmit ();
		
		$form->onSubmit ( function ($form) {
			if ($form->get ('paswoord') == '')
				throw $form->exception ( 'Paswoord mag niet leeg zijn' )->setField ( 'paswoord' );
			if ($form->get ( 'paswoord' ) != $form->get ( 'bevestigPaswoord' ))
				throw $form->exception ( 'Paswoorden verschillen' )->setField ( 'bevestigPaswoord' );
			$form->model->set ( 'paswoord', $form->api->auth->encryptPassword ( $form->get ( 'paswoord' ), $form->get ( 'email' ) ) );
			$form->update ();
			$form->model->save();
			$form->js ()->hide ( 'slow' )->univ ()->successMessage ( 'Gebruiker bewaard' )->execute ();
		} );
	}
}
<commit_msg>326: Initial user is admin<commit_after><?php
class page_bootstrap extends Page {
	function init() {
		parent::init ();
		$model = $this->add ( 'Model_Account' );
		
		if ($model->count ()->getOne () > 0) {
			throw $this->exception ( 'Init reeds gebeurd' );
		}
		
		$form = $this->add ( 'MVCForm' );
		$form->setModel ( $model );
		$form->addField ( 'password', '<PASSWORD>' )->isMandatory ( true );
		$form->addField ( 'password', '<PASSWORD>igPaswoord' )->isMandatory ( true );
		$form->addSubmit ();
		
		$form->onSubmit ( function ($form) {
			if ($form->get ('paswoord') == '')
				throw $form->exception ( 'Paswoord mag niet leeg zijn' )->setField ( 'paswoord' );
			if ($form->get ( 'paswoord' ) != $form->get ( 'bevestigPaswoord' ))
				throw $form->exception ( 'Paswoorden verschillen' )->setField ( 'bevestigPaswoord' );
			$form->model->set ( 'paswoord', $form->api->auth->encryptPassword ( $form->get ( 'paswoord' ), $form->get ( 'email' ) ) );
			$form->model->set('admin', true);
			$form->update ();
			$form->model->save();
			$form->js ()->hide ( 'slow' )->univ ()->successMessage ( 'Gebruiker bewaard' )->execute ();
		} );
	}
}

{'fraction_non_alphanumeric': 0.2287756925826631, 'fraction_numerical': 0.002234137622877569, 'mean_word_length': 3.7436440677966103, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 79, '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': '3992626', 'n_tokens_mistral': 897, 'n_tokens_neox': 803, 'n_words': 164}