Fix returning global message in `start-session`

This commit is contained in:
Florine W. Dekker 2022-12-01 20:36:51 +01:00
parent 0cf3897f79
commit 560c50e027
Signed by: FWDekker
GPG Key ID: D3DCFAA8A4560BE0
7 changed files with 12 additions and 6 deletions

View File

@ -1,7 +1,7 @@
{
"name": "fwdekker/death-notifier",
"description": "Get notified when a famous person dies.",
"version": "0.15.1", "_comment_version": "Also update version in `package.json`!",
"version": "0.15.2", "_comment_version": "Also update version in `package.json`!",
"type": "project",
"license": "MIT",
"homepage": "https://git.fwdekker.com/tools/death-notifier",

BIN
composer.lock generated

Binary file not shown.

BIN
package-lock.json generated

Binary file not shown.

View File

@ -1,6 +1,6 @@
{
"name": "death-notifier",
"version": "0.15.1", "_comment_version": "Also update version in `composer.json`!",
"version": "0.15.2", "_comment_version": "Also update version in `composer.json`!",
"description": "Get notified when a famous person dies.",
"author": "Florine W. Dekker",
"browser": "dist/bundle.js",

View File

@ -59,7 +59,7 @@ try {
// Dispatch request
$dispatcher = new ActionDispatcher();
// GET actions
$dispatcher->register_action(new StartSessionAction($user_manager));
$dispatcher->register_action(new StartSessionAction($config, $user_manager));
$dispatcher->register_action(new GetUserDataAction($user_manager));
$dispatcher->register_action(new ListTrackingsAction($tracking_manager));
$dispatcher->register_action(new ValidatePasswordResetTokenAction($user_manager));

View File

@ -11,6 +11,10 @@ use Exception;
*/
class StartSessionAction extends Action
{
/**
* @var array the application's configuration
*/
private readonly array $config;
/**
* @var UserManager the manager to validate the session through
*/
@ -20,12 +24,14 @@ class StartSessionAction extends Action
/**
* Constructs a new `StartSessionAction`.
*
* @param mixed $config the application's configuration
* @param UserManager $user_manager the manager to validate the session through
*/
public function __construct(UserManager $user_manager)
public function __construct(array $config, UserManager $user_manager)
{
parent::__construct(ActionMethod::GET, "start-session");
$this->config = $config;
$this->user_manager = $user_manager;
}

View File

@ -66,9 +66,9 @@ class Util
/**
* Parses POST values from JSON-based inputs.
*
* @return array<int|string, mixed> the parsed POST-ed values
* @return array<int|string, mixed>|null the parsed POST-ed values
*/
static function parse_post(): array
static function parse_post(): ?array
{
$output = $_POST;