This commit is contained in:
Marcel Pociot committed 2020-04-27 10:05:42 +02:00
1 parent 28c4009dff
commit 054e5b6a86
20 files changed
+737 -461

No files matched your search

@@ -78,6 +78,10 @@ class ControlMessageController implements MessageComponentInterface
$this->verifyAuthToken($connection);
}
if (! $this->hasValidSubdomain($connection, $data->subdomain)) {
return;
}
$connectionInfo = $this->connectionManager->storeConnection($data->host, $data->subdomain, $connection);
$connection->send(json_encode([
@@ -122,4 +126,24 @@ class ControlMessageController implements MessageComponentInterface
}
});
}
protected function hasValidSubdomain(ConnectionInterface $connection, ?string $subdomain): bool
{
if (! is_null($subdomain)) {
$controlConnection = $this->connectionManager->findControlConnectionForSubdomain($subdomain);
if (! is_null($controlConnection) || $subdomain === config('expose.dashboard_subdomain')) {
$connection->send(json_encode([
'event' => 'subdomainTaken',
'data' => [
'subdomain' => $subdomain,
]
]));
$connection->close();
return false;
}
}
return true;
}
}