mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #5286 from beganovich/v5-3003-company-user-registration
(v5) Fix acessing client register route without company instance
This commit is contained in:
commit
eec902429a
@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Http\Requests\ClientPortal;
|
||||
|
||||
use App\Models\Account;
|
||||
use App\Models\Company;
|
||||
use App\Utils\Ninja;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class RegisterRequest extends FormRequest
|
||||
@ -43,6 +45,14 @@ class RegisterRequest extends FormRequest
|
||||
return Company::where('company_key', $this->company_key)->firstOrFail();
|
||||
}
|
||||
|
||||
if (!$this->route()->parameter('company_key') && Ninja::isSelfHost()) {
|
||||
$company = Account::first()->default_company;
|
||||
|
||||
abort_unless($company->client_can_register, 404);
|
||||
|
||||
return $company;
|
||||
}
|
||||
|
||||
abort(404);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user