Added CSRF check in weatherdata API

This commit is contained in:
Dale Davies
2022-04-13 16:28:12 +01:00
parent ad3de9cd27
commit 490758bae8
13 changed files with 86 additions and 17 deletions

View File

@@ -42,9 +42,18 @@ class Config {
'noindex'
];
/**
* Session config params.
*/
private const CONFIG_SESSION = [
'sessionname' => 'JUMP',
'sessiontimeout' => '10 minutes'
];
public function __construct() {
$this->config = new \PHLAK\Config\Config(__DIR__.'/../config.php');
$this->add_wwwroot_to_base_paths();
$this->add_session_config();
if ($this->config_params_missing()) {
throw new Exception('Config.php must always contain... '.implode(', ', self::CONFIG_PARAMS));
}
@@ -63,6 +72,11 @@ class Config {
}
}
private function add_session_config(): void {
foreach(self::CONFIG_SESSION as $key => $value) {
$this->config->set($key, $value);
}
}
/**
* Determine if any configuration params are missing in the list loaded
* from the config.php.