mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 21:45:55 +00:00
API modifications
This commit is contained in:
@@ -39,7 +39,8 @@ class StoreSubdomainController extends AdminController
|
||||
return;
|
||||
}
|
||||
|
||||
$this->userRepository->getUserByToken($request->get('auth_token', ''))
|
||||
$this->userRepository
|
||||
->getUserByToken($request->get('auth_token', ''))
|
||||
->then(function ($user) use ($httpConnection, $request) {
|
||||
if (is_null($user)) {
|
||||
$httpConnection->send(respond_json(['error' => 'The user does not exist'], 404));
|
||||
@@ -55,6 +56,13 @@ class StoreSubdomainController extends AdminController
|
||||
return;
|
||||
}
|
||||
|
||||
if (in_array($request->get('subdomain'), config('expose.admin.reserved_subdomains', []))) {
|
||||
$httpConnection->send(respond_json(['error' => 'The subdomain is already taken.'], 422));
|
||||
$httpConnection->close();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$insertData = [
|
||||
'user_id' => $user['id'],
|
||||
'subdomain' => $request->get('subdomain'),
|
||||
|
||||
Reference in New Issue
Block a user