mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Make terms/privacy policy checkbox required if fields are present
This commit is contained in:
parent
003d1fb143
commit
77513de2a5
@ -27,17 +27,23 @@ class RegisterRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
$rules = [
|
||||||
'first_name' => ['required', 'string', 'max:255'],
|
'first_name' => ['required', 'string', 'max:255'],
|
||||||
'last_name' => ['required', 'string', 'max:255'],
|
'last_name' => ['required', 'string', 'max:255'],
|
||||||
'phone' => ['required', 'string', 'max:255'],
|
'phone' => ['required', 'string', 'max:255'],
|
||||||
'email' => ['required', 'string', 'email:rfc,dns', 'max:255'],
|
'email' => ['required', 'string', 'email:rfc,dns', 'max:255'],
|
||||||
'password' => ['required', 'string', 'min:6', 'confirmed'],
|
'password' => ['required', 'string', 'min:6', 'confirmed'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($this->company()->settings->client_portal_terms || $this->company()->settings->client_portal_privacy_policy) {
|
||||||
|
$rules['terms'] = ['required'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function company()
|
public function company()
|
||||||
{
|
{
|
||||||
|
|
||||||
//this should be all we need, the rest SHOULD be redundant because of our Middleware
|
//this should be all we need, the rest SHOULD be redundant because of our Middleware
|
||||||
if ($this->key)
|
if ($this->key)
|
||||||
@ -59,7 +65,7 @@ class RegisterRequest extends FormRequest
|
|||||||
if (Ninja::isHosted()) {
|
if (Ninja::isHosted()) {
|
||||||
|
|
||||||
$subdomain = explode('.', $this->getHost())[0];
|
$subdomain = explode('.', $this->getHost())[0];
|
||||||
|
|
||||||
$query = [
|
$query = [
|
||||||
'subdomain' => $subdomain,
|
'subdomain' => $subdomain,
|
||||||
'portal_mode' => 'subdomain',
|
'portal_mode' => 'subdomain',
|
||||||
@ -67,7 +73,7 @@ class RegisterRequest extends FormRequest
|
|||||||
|
|
||||||
if($company = MultiDB::findAndSetDbByDomain($query))
|
if($company = MultiDB::findAndSetDbByDomain($query))
|
||||||
return $company;
|
return $company;
|
||||||
|
|
||||||
$query = [
|
$query = [
|
||||||
'portal_domain' => $this->getSchemeAndHttpHost(),
|
'portal_domain' => $this->getSchemeAndHttpHost(),
|
||||||
'portal_mode' => 'domain',
|
'portal_mode' => 'domain',
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<a class="button-link" x-on:click="{{ $property }} = true" href="#">{{ ctrans("texts.$property") }}</a>
|
<a class="button-link underline" x-on:click="{{ $property }} = true" href="#">{{ ctrans("texts.$property") }}</a>
|
||||||
|
|
||||||
<span class="text-gray-300">/</span>
|
<span class="text-gray-300">/</span>
|
||||||
|
|
||||||
<div x-show="{{ $property }}" class="fixed bottom-0 inset-x-0 px-4 pb-4 sm:inset-0 sm:flex sm:items-center sm:justify-center">
|
<div x-show="{{ $property }}" class="fixed bottom-0 inset-x-0 px-4 pb-4 sm:inset-0 sm:flex sm:items-center sm:justify-center">
|
||||||
@ -27,4 +28,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,11 +28,15 @@
|
|||||||
<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') }}
|
{{ 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($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($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($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])
|
||||||
|
|
||||||
|
@error('terms')
|
||||||
|
<p class="text-red-600">{{ $message }}</p>
|
||||||
|
@enderror
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user