/** * @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>'); } }
/** * @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"); }
/** * 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; }
/** * @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); } }
/** * @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); }