fix: timezone settings validation

This commit is contained in:
Andras Bacsai
2024-11-14 10:02:37 +01:00
parent 3bfa21be59
commit b0b81e4416
5 changed files with 30 additions and 13 deletions

View File

@@ -127,7 +127,14 @@ class Show extends Component
$this->server->settings->sentinel_custom_url = $this->sentinelCustomUrl;
$this->server->settings->is_sentinel_enabled = $this->isSentinelEnabled;
$this->server->settings->is_sentinel_debug_enabled = $this->isSentinelDebugEnabled;
$this->server->settings->server_timezone = $this->serverTimezone;
if (! validate_timezone($this->serverTimezone)) {
$this->serverTimezone = config('app.timezone');
throw new \Exception('Invalid timezone.');
} else {
$this->server->settings->server_timezone = $this->serverTimezone;
}
$this->server->settings->save();
} else {
$this->name = $this->server->name;

View File

@@ -139,6 +139,14 @@ class Index extends Component
$error_show = false;
$this->server = Server::findOrFail(0);
$this->resetErrorBag();
if (! validate_timezone($this->instance_timezone)) {
$this->instance_timezone = config('app.timezone');
throw new \Exception('Invalid timezone.');
} else {
$this->settings->instance_timezone = $this->instance_timezone;
}
if ($this->settings->public_port_min > $this->settings->public_port_max) {
$this->addError('settings.public_port_min', 'The minimum port must be lower than the maximum port.');