Compare commits
7 Commits
88cf11d45d
...
9ee8ae39df
Author | SHA1 | Date |
---|---|---|
tracer | 9ee8ae39df | |
tracer | 70aa4d1f06 | |
tracer | 2f99531780 | |
tracer | 60860a0bce | |
tracer | bb3d0f6e1b | |
tracer | 7ee8e8860e | |
tracer | 32dcab7592 |
|
@ -12,6 +12,11 @@ ini_set(option: 'display_startup_errors', value: 1);
|
|||
// no one sane should ignore deprecations
|
||||
error_reporting(error_level: E_ALL);
|
||||
|
||||
// just during dev
|
||||
opcache_reset();
|
||||
|
||||
|
||||
|
||||
session_start();
|
||||
|
||||
require dirname(path: __DIR__) . '/src/bootstrap.php';
|
||||
|
|
|
@ -32,6 +32,7 @@ class SecurityController
|
|||
$password = $_POST['password'] ?? '';
|
||||
|
||||
if ($nick && $password) {
|
||||
$nick = strtolower(string: $nick);
|
||||
if ($user = $this->userRepository->findbyNick(nick: $nick)) {
|
||||
if (password_verify(password: $password, hash: $user->getPassword())) {
|
||||
$_SESSION['user_id'] = $user->getId();
|
||||
|
|
|
@ -105,7 +105,6 @@ class AddressRepository
|
|||
public function update(AddressBookEntry $address): bool|int
|
||||
{
|
||||
$id = $address->getId();
|
||||
$owner = $address->getOwner();
|
||||
$first = $address->getFirst();
|
||||
$last = $address->getLast();
|
||||
$street = $address->getStreet();
|
||||
|
|
|
@ -71,6 +71,8 @@ class UserRepository
|
|||
|
||||
public function findByNick(string $nick): ?User
|
||||
{
|
||||
$nick = strtolower(string: $nick);
|
||||
|
||||
$sql = "
|
||||
SELECT id, nick, password, first, last, is_admin
|
||||
FROM " . DatabaseConnection::TABLE_USERS . "
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
namespace App\Service;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -84,7 +84,7 @@ class Router
|
|||
|
||||
foreach ($this->dynamicRoutes as $route) {
|
||||
// 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 = [];
|
||||
if (preg_match(pattern: $route->getRegex(), subject: $requestUri, matches: $matches)) {
|
||||
foreach ($route->getParameters() as $id => $parameter) {
|
||||
|
|
|
@ -13,8 +13,6 @@ namespace App\Service;
|
|||
* using PHP as a templating engine.
|
||||
*/
|
||||
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
|
||||
class Template
|
||||
{
|
||||
/*
|
||||
|
@ -28,8 +26,7 @@ class Template
|
|||
/*
|
||||
* Add variables to template and throw it out
|
||||
*/
|
||||
#[NoReturn]
|
||||
public function render(string $templateName, array $vars = []): void
|
||||
public function render(string $templateName, array $vars = []): never
|
||||
{
|
||||
// assign template vars
|
||||
foreach ($vars as $name => $value) {
|
||||
|
|
Loading…
Reference in New Issue