Compare commits

..

7 Commits

Author SHA1 Message Date
tracer 9ee8ae39df added opcache_ireset() for debugging 2022-10-27 10:37:05 +02:00
tracer 70aa4d1f06 changed some wording in comments 2022-10-26 13:16:04 +02:00
tracer 2f99531780 changed render from void to never 2022-10-26 13:15:41 +02:00
tracer 60860a0bce removed unused exception 2022-10-26 13:15:08 +02:00
tracer bb3d0f6e1b lowercase login user 2022-10-26 13:14:39 +02:00
tracer 7ee8e8860e lowercase login user 2022-10-26 13:14:29 +02:00
tracer 32dcab7592 removed owner in update, we don't use it 2022-10-26 12:47:42 +02:00
7 changed files with 10 additions and 8 deletions

View File

@ -12,6 +12,11 @@ ini_set(option: 'display_startup_errors', value: 1);
// no one sane should ignore deprecations // no one sane should ignore deprecations
error_reporting(error_level: E_ALL); error_reporting(error_level: E_ALL);
// just during dev
opcache_reset();
session_start(); session_start();
require dirname(path: __DIR__) . '/src/bootstrap.php'; require dirname(path: __DIR__) . '/src/bootstrap.php';

View File

@ -32,6 +32,7 @@ class SecurityController
$password = $_POST['password'] ?? ''; $password = $_POST['password'] ?? '';
if ($nick && $password) { if ($nick && $password) {
$nick = strtolower(string: $nick);
if ($user = $this->userRepository->findbyNick(nick: $nick)) { if ($user = $this->userRepository->findbyNick(nick: $nick)) {
if (password_verify(password: $password, hash: $user->getPassword())) { if (password_verify(password: $password, hash: $user->getPassword())) {
$_SESSION['user_id'] = $user->getId(); $_SESSION['user_id'] = $user->getId();

View File

@ -105,7 +105,6 @@ class AddressRepository
public function update(AddressBookEntry $address): bool|int public function update(AddressBookEntry $address): bool|int
{ {
$id = $address->getId(); $id = $address->getId();
$owner = $address->getOwner();
$first = $address->getFirst(); $first = $address->getFirst();
$last = $address->getLast(); $last = $address->getLast();
$street = $address->getStreet(); $street = $address->getStreet();

View File

@ -71,6 +71,8 @@ class UserRepository
public function findByNick(string $nick): ?User public function findByNick(string $nick): ?User
{ {
$nick = strtolower(string: $nick);
$sql = " $sql = "
SELECT id, nick, password, first, last, is_admin SELECT id, nick, password, first, last, is_admin
FROM " . DatabaseConnection::TABLE_USERS . " FROM " . DatabaseConnection::TABLE_USERS . "

View File

@ -9,8 +9,6 @@
namespace App\Service; namespace App\Service;
use Exception;
/** /**
* *
*/ */

View File

@ -84,7 +84,7 @@ class Router
foreach ($this->dynamicRoutes as $route) { foreach ($this->dynamicRoutes as $route) {
// PHPStorm doesn't know that $parameters are always available, // PHPStorm doesn't know that $parameters are always available,
// (as it is a dynamic route) so I init the array just to make PHPStorm happy. // (as it this are dynamic routes) so I init the array just to make PHPStorm happy.
$parameters = []; $parameters = [];
if (preg_match(pattern: $route->getRegex(), subject: $requestUri, matches: $matches)) { if (preg_match(pattern: $route->getRegex(), subject: $requestUri, matches: $matches)) {
foreach ($route->getParameters() as $id => $parameter) { foreach ($route->getParameters() as $id => $parameter) {

View File

@ -13,8 +13,6 @@ namespace App\Service;
* using PHP as a templating engine. * using PHP as a templating engine.
*/ */
use JetBrains\PhpStorm\NoReturn;
class Template class Template
{ {
/* /*
@ -28,8 +26,7 @@ class Template
/* /*
* Add variables to template and throw it out * Add variables to template and throw it out
*/ */
#[NoReturn] public function render(string $templateName, array $vars = []): never
public function render(string $templateName, array $vars = []): void
{ {
// assign template vars // assign template vars
foreach ($vars as $name => $value) { foreach ($vars as $name => $value) {