This commit is contained in:
Marcel Pociot
2021-06-14 13:14:20 +02:00
parent 7c78f7e2b1
commit 6ffd5274b3
4 changed files with 69 additions and 3 deletions

View File

@@ -323,9 +323,13 @@ class ControlMessageController implements MessageComponentInterface
* Check if the given subdomain is reserved for a different user.
*/
if (! is_null($subdomain)) {
return $this->subdomainRepository->getSubdomainByNameAndDomain($subdomain, $serverHost)
->then(function ($foundSubdomain) use ($connection, $subdomain, $user, $serverHost) {
if (! is_null($foundSubdomain) && ! is_null($user) && $foundSubdomain['user_id'] !== $user['id']) {
return $this->subdomainRepository->getSubdomainsByNameAndDomain($subdomain, $serverHost)
->then(function ($foundSubdomains) use ($connection, $subdomain, $user, $serverHost) {
$ownSubdomain = collect($foundSubdomains)->first(function ($subdomain) use ($user) {
return $subdomain['user_id'] === $user['id'];
});
if (count($foundSubdomains) > 0 && ! is_null($user) && is_null($ownSubdomain)) {
$message = config('expose.admin.messages.subdomain_reserved');
$message = str_replace(':subdomain', $subdomain, $message);