Merge pull request #5546 from turbo124/v5-develop

Custom domain validation update
This commit is contained in:
David Bomba 2021-04-28 13:14:00 +10:00 committed by GitHub
commit cf1e844114
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

View File

@ -15,6 +15,18 @@ use App\Libraries\MultiDB;
class SubdomainController extends BaseController
{
private $protected = [
'www',
'app',
'ninja',
'sentry',
'staging',
'pdf',
'demo',
'docs',
'client_domain',
'custom_domain',
];
public function __construct()
{
@ -29,7 +41,7 @@ class SubdomainController extends BaseController
public function index()
{
if( MultiDB::findAndSetDbByDomain(request()->input('subdomain')) )
if(in_array(request()->input('subdomain'), $this->protected) || MultiDB::findAndSetDbByDomain(request()->input('subdomain')))
return response()->json(['message' => 'Domain not available'] , 401);
return response()->json(['message' => 'Domain available'], 200);

View File

@ -34,13 +34,15 @@ class StoreCompanyRequest extends Request
public function rules()
{
$input = $this->all();
$rules = [];
$rules['name'] = new ValidCompanyQuantity();
$rules['company_logo'] = 'mimes:jpeg,jpg,png,gif|max:10000'; // max 10000kb
$rules['settings'] = new ValidSettingsRule();
if (isset($rules['portal_mode']) && ($rules['portal_mode'] == 'domain' || $rules['portal_mode'] == 'iframe')) {
if (isset($input['portal_mode']) && ($input['portal_mode'] == 'domain' || $input['portal_mode'] == 'iframe')) {
$rules['portal_domain'] = 'sometimes|url';
} else {
$rules['portal_domain'] = 'nullable|alpha_num';

View File

@ -32,6 +32,8 @@ class UpdateCompanyRequest extends Request
public function rules()
{
$input = $this->all();
$rules = [];
$rules['company_logo'] = 'mimes:jpeg,jpg,png,gif|max:10000'; // max 10000kb