Ejemplo n.º 1
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $user = $this->userFacade->createUser($input->getArgument("name"), $input->getArgument("email"), $input->getArgument("password"));
     if (!$user) {
         $output->writeln('<error>Email already registered, pick another email</error>');
     }
 }
Ejemplo n.º 2
0
 /**
  * @param int $id
  */
 public function handleDeleteUser($id)
 {
     $user = $this->userFacade->findUserById($id);
     $this->userFacade->deleteUser($user);
     $this->flashMessage('Uživatel byl smazán', "success");
     $this->redirect(":Users:default");
 }
Ejemplo n.º 3
0
 /**
  * Performs an authentication.
  *
  * @param array $credentials
  * @return Nette\Security\Identity
  * @throws Nette\Security\AuthenticationException
  */
 public function authenticate(array $credentials)
 {
     list($email, $password) = $credentials;
     $row = $this->userFacade->findUserByEmail($email);
     if (!$row) {
         throw new Nette\Security\AuthenticationException('The username is incorrect.', self::IDENTITY_NOT_FOUND);
     } elseif (!self::verifyPassword($password, $row->password)) {
         throw new Nette\Security\AuthenticationException('The password is incorrect.', self::INVALID_CREDENTIAL);
     }
     return $row;
 }
Ejemplo n.º 4
0
 /**
  * @param \Nette\Application\UI\Form $form
  */
 public function processForm(Form $form)
 {
     $values = $form->values;
     if ($this->user) {
         $user = $this->user;
         $user->name = $values->name;
         $user->email = $values->email;
         if ($values->password) {
             $user->setPassword($values->password);
         }
         $this->userFacade->save($user);
     } else {
         $this->user = $this->userFacade->createUser($values->name, $values->email, $values->password);
     }
 }
Ejemplo n.º 5
0
 /**
  * @param \Nette\Application\UI\Form $form
  */
 public function processForm(Form $form)
 {
     $values = $form->values;
     $teacher = $values->teacher ? $this->userFacade->findUserById($values->teacher) : null;
     if ($this->child) {
         $child = $this->child;
         $child->teacher = $teacher;
     } else {
         $child = new Entity\Child($this->performance, $teacher);
     }
     $child->name = $values->name;
     $child->instrument = $values->instrument;
     $child->class = $values->class;
     $this->childFacade->save($child);
 }