Permalink
Browse files

coding style

  • Loading branch information...
dg committed Aug 12, 2017
1 parent 82ffc49 commit e92b9ce6b47366752afc52ba8e2e623f0eb28234
Showing with 7 additions and 3 deletions.
  1. +3 −1 app/model/UserManager.php
  2. +2 −1 app/presenters/Error4xxPresenter.php
  3. +2 −1 app/presenters/ErrorPresenter.php
@@ -41,7 +41,9 @@ public function authenticate(array $credentials): Nette\Security\IIdentity
{
[$username, $password] = $credentials;
$row = $this->database->table(self::TABLE_NAME)->where(self::COLUMN_NAME, $username)->fetch();
$row = $this->database->table(self::TABLE_NAME)
->where(self::COLUMN_NAME, $username)
->fetch();
if (!$row) {
throw new Nette\Security\AuthenticationException('The username is incorrect.', self::IDENTITY_NOT_FOUND);
@@ -21,6 +21,7 @@ public function renderDefault(Nette\Application\BadRequestException $exception)
{
// load template 403.latte or 404.latte or ... 4xx.latte
$file = __DIR__ . "/templates/Error/{$exception->getCode()}.latte";
$this->template->setFile(is_file($file) ? $file : __DIR__ . '/templates/Error/4xx.latte');
$file = is_file($file) ? $file : __DIR__ . '/templates/Error/4xx.latte';
$this->template->setFile($file);
}
}
@@ -32,7 +32,8 @@ public function run(Nette\Application\Request $request): Nette\Application\IResp
if ($e instanceof Nette\Application\BadRequestException) {
// $this->logger->log("HTTP code {$e->getCode()}: {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", 'access');
[$module, , $sep] = Nette\Application\Helpers::splitName($request->getPresenterName());
return new Responses\ForwardResponse($request->setPresenterName($module . $sep . 'Error4xx'));
$errorPresenter = $module . $sep . 'Error4xx';
return new Responses\ForwardResponse($request->setPresenterName($errorPresenter));
}
$this->logger->log($e, ILogger::EXCEPTION);

0 comments on commit e92b9ce

Please sign in to comment.