Exemplo n.º 1
0
 protected function startup()
 {
     parent::startup();
     $this->template->step = NULL;
     if (!$this->steps->getFromCache(Steps::Step3)) {
         $this->redirect(':Install:Install:');
     }
 }
Exemplo n.º 2
0
 /**
  * Factory for registration administration account.
  * @param  class Translator
  * @param  callable
  * @return Form
  */
 public function registrationAccount($translator, callable $onSuccess)
 {
     $form = $this->forms->create($translator);
     $form->addText('realname', 'install.acc.name')->setRequired('install.form.empty');
     $form->addText('email', 'install.acc.email')->setDefaultValue('@')->setType('email')->setRequired('install.form.empty')->addRule(Form::EMAIL, 'install.acc.email.invalid');
     $form->addPassword('password', 'install.acc.pass')->setRequired('install.form.empty')->addRule(Form::MIN_LENGTH, 'install.acc.pass.min', 6);
     $form->addPassword('verify', 'install.acc.pass.verify')->setRequired('install.form.empty')->addRule(Form::EQUAL, 'install.acc.pass.verify.invalid', $form['password']);
     $form->addSubmit('send', 'install.acc.send');
     $form->onSuccess[] = function (Form $form) use($onSuccess) {
         // Form processing.
         $values = $form->getValues();
         $table = $this->getTablePrefix() . 'users';
         // Hash password.
         $values->password = Passwords::hash($values->password);
         // Delete unneeded values.
         unset($values->verify, $values->prefix);
         // Insert records into the database.
         $this->query->addValues($table, $values);
         // Save the installation step into the cache.
         $this->steps->setToCache(Steps::Step4, rand(1, 9));
         $onSuccess();
     };
     return $form;
 }
Exemplo n.º 3
0
 public function handleRun()
 {
     $this->steps->setToCache(Steps::Start, rand(1, 9));
     $this->redirect(self::TemplateStep, ['id' => 1]);
 }