mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 22:54:25 +01:00
Fixes for contact registration
This commit is contained in:
parent
130803efd6
commit
154f029a84
@ -35,7 +35,10 @@ class ContactRegisterController extends Controller
|
|||||||
public function showRegisterForm(string $company_key = '')
|
public function showRegisterForm(string $company_key = '')
|
||||||
{
|
{
|
||||||
|
|
||||||
$key = request()->session()->has('company_key') ? request()->session()->get('company_key') : $company_key;
|
if(strlen($company_key) > 2)
|
||||||
|
$key = $company_key;
|
||||||
|
else
|
||||||
|
$key = request()->session()->has('company_key') ? request()->session()->get('company_key') : $company_key;
|
||||||
|
|
||||||
$company = Company::where('company_key', $key)->firstOrFail();
|
$company = Company::where('company_key', $key)->firstOrFail();
|
||||||
|
|
||||||
@ -43,7 +46,7 @@ class ContactRegisterController extends Controller
|
|||||||
$t = app('translator');
|
$t = app('translator');
|
||||||
$t->replace(Ninja::transformTranslations($company->settings));
|
$t->replace(Ninja::transformTranslations($company->settings));
|
||||||
|
|
||||||
return render('auth.register', ['company' => $company, 'account' => $company->account]);
|
return render('auth.register', ['register_company' => $company, 'account' => $company->account]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register(RegisterRequest $request)
|
public function register(RegisterRequest $request)
|
||||||
@ -60,6 +63,7 @@ class ContactRegisterController extends Controller
|
|||||||
|
|
||||||
private function getClient(array $data)
|
private function getClient(array $data)
|
||||||
{
|
{
|
||||||
|
|
||||||
$client = ClientFactory::create($data['company']->id, $data['company']->owner()->id);
|
$client = ClientFactory::create($data['company']->id, $data['company']->owner()->id);
|
||||||
|
|
||||||
$client->fill($data);
|
$client->fill($data);
|
||||||
@ -73,7 +77,7 @@ class ContactRegisterController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getClientContact($data, $client);
|
// $this->getClientContact($data, $client);
|
||||||
|
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
@ -68,11 +68,9 @@ class ContactRegister
|
|||||||
|
|
||||||
// For self-hosted platforms with multiple companies, resolving is done using company key
|
// For self-hosted platforms with multiple companies, resolving is done using company key
|
||||||
// if it doesn't resolve using a domain.
|
// if it doesn't resolve using a domain.
|
||||||
|
|
||||||
if ($request->company_key && Ninja::isSelfHost()) {
|
if ($request->company_key && Ninja::isSelfHost() && $company = Company::where('company_key', $request->company_key)->first()) {
|
||||||
|
|
||||||
$company = Company::where('company_key', $request->company_key)->firstOrFail();
|
|
||||||
|
|
||||||
if(! (bool)$company->client_can_register)
|
if(! (bool)$company->client_can_register)
|
||||||
abort(400, 'Registration disabled');
|
abort(400, 'Registration disabled');
|
||||||
|
|
||||||
|
@ -5,21 +5,21 @@
|
|||||||
<div class="grid lg:grid-cols-12 py-8">
|
<div class="grid lg:grid-cols-12 py-8">
|
||||||
<div class="col-span-12 lg:col-span-8 lg:col-start-3 xl:col-span-6 xl:col-start-4 px-6">
|
<div class="col-span-12 lg:col-span-8 lg:col-start-3 xl:col-span-6 xl:col-start-4 px-6">
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
<img class="h-32 w-auto" src="{{ $company->present()->logo() }}" alt="{{ ctrans('texts.logo') }}">
|
<img class="h-32 w-auto" src="{{ $register_company->present()->logo() }}" alt="{{ ctrans('texts.logo') }}">
|
||||||
</div>
|
</div>
|
||||||
<h1 class="text-center text-3xl mt-8">{{ ctrans('texts.register') }}</h1>
|
<h1 class="text-center text-3xl mt-8">{{ ctrans('texts.register') }}</h1>
|
||||||
<p class="block text-center text-gray-600">{{ ctrans('texts.register_label') }}</p>
|
<p class="block text-center text-gray-600">{{ ctrans('texts.register_label') }}</p>
|
||||||
|
|
||||||
<form action="{{ route('client.register', request()->route('company_key')) }}" method="POST" x-data="{ more: false }">
|
<form action="{{ route('client.register', request()->route('company_key')) }}" method="POST" x-data="{ more: false }">
|
||||||
@if($company)
|
@if($register_company)
|
||||||
<input type="hidden" name="company_key" value="{{ $company->company_key }}">
|
<input type="hidden" name="company_key" value="{{ $register_company->company_key }}">
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
<div class="grid grid-cols-12 gap-4 mt-10">
|
<div class="grid grid-cols-12 gap-4 mt-10">
|
||||||
@if($company->client_registration_fields)
|
@if($register_company->client_registration_fields)
|
||||||
@foreach($company->client_registration_fields as $field)
|
@foreach($register_company->client_registration_fields as $field)
|
||||||
@if($field['required'])
|
@if($field['required'])
|
||||||
<div class="col-span-12 md:col-span-6">
|
<div class="col-span-12 md:col-span-6">
|
||||||
<section class="flex items-center">
|
<section class="flex items-center">
|
||||||
@ -108,15 +108,15 @@
|
|||||||
|
|
||||||
<div class="flex justify-between items-center mt-8">
|
<div class="flex justify-between items-center mt-8">
|
||||||
<span class="inline-flex items-center" x-data="{ terms_of_service: false, privacy_policy: false }">
|
<span class="inline-flex items-center" x-data="{ terms_of_service: false, privacy_policy: false }">
|
||||||
@if(!empty($company->settings->client_portal_terms) || !empty($company->settings->client_portal_privacy_policy))
|
@if(!empty($register_company->settings->client_portal_terms) || !empty($register_company->settings->client_portal_privacy_policy))
|
||||||
<input type="checkbox" name="terms" class="form-checkbox mr-2 cursor-pointer" checked>
|
<input type="checkbox" name="terms" class="form-checkbox mr-2 cursor-pointer" checked>
|
||||||
<span class="text-sm text-gray-800">
|
<span class="text-sm text-gray-800">
|
||||||
|
|
||||||
{{ ctrans('texts.i_agree_to_the') }}
|
{{ ctrans('texts.i_agree_to_the') }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@includeWhen(!empty($company->settings->client_portal_terms), 'portal.ninja2020.auth.includes.register.popup', ['property' => 'terms_of_service', 'title' => ctrans('texts.terms_of_service'), 'content' => $company->settings->client_portal_terms])
|
@includeWhen(!empty($register_company->settings->client_portal_terms), 'portal.ninja2020.auth.includes.register.popup', ['property' => 'terms_of_service', 'title' => ctrans('texts.terms_of_service'), 'content' => $register_company->settings->client_portal_terms])
|
||||||
@includeWhen(!empty($company->settings->client_portal_privacy_policy), 'portal.ninja2020.auth.includes.register.popup', ['property' => 'privacy_policy', 'title' => ctrans('texts.privacy_policy'), 'content' => $company->settings->client_portal_privacy_policy])
|
@includeWhen(!empty($register_company->settings->client_portal_privacy_policy), 'portal.ninja2020.auth.includes.register.popup', ['property' => 'privacy_policy', 'title' => ctrans('texts.privacy_policy'), 'content' => $register_company->settings->client_portal_privacy_policy])
|
||||||
|
|
||||||
@error('terms')
|
@error('terms')
|
||||||
<p class="text-red-600">{{ $message }}</p>
|
<p class="text-red-600">{{ $message }}</p>
|
||||||
|
Loading…
Reference in New Issue
Block a user