diff --git a/app/Http/Requests/ClientPortal/RegisterRequest.php b/app/Http/Requests/ClientPortal/RegisterRequest.php index 8ec7d723b8d2..2286e31ea736 100644 --- a/app/Http/Requests/ClientPortal/RegisterRequest.php +++ b/app/Http/Requests/ClientPortal/RegisterRequest.php @@ -27,17 +27,23 @@ class RegisterRequest extends FormRequest */ public function rules() { - return [ + $rules = [ 'first_name' => ['required', 'string', 'max:255'], 'last_name' => ['required', 'string', 'max:255'], 'phone' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'email:rfc,dns', 'max:255'], '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() - { + { //this should be all we need, the rest SHOULD be redundant because of our Middleware if ($this->key) @@ -59,7 +65,7 @@ class RegisterRequest extends FormRequest if (Ninja::isHosted()) { $subdomain = explode('.', $this->getHost())[0]; - + $query = [ 'subdomain' => $subdomain, 'portal_mode' => 'subdomain', @@ -67,7 +73,7 @@ class RegisterRequest extends FormRequest if($company = MultiDB::findAndSetDbByDomain($query)) return $company; - + $query = [ 'portal_domain' => $this->getSchemeAndHttpHost(), 'portal_mode' => 'domain', diff --git a/resources/views/portal/ninja2020/auth/includes/register/popup.blade.php b/resources/views/portal/ninja2020/auth/includes/register/popup.blade.php index 9585bfd0125e..b1578d5d32dc 100644 --- a/resources/views/portal/ninja2020/auth/includes/register/popup.blade.php +++ b/resources/views/portal/ninja2020/auth/includes/register/popup.blade.php @@ -1,4 +1,5 @@ -{{ ctrans("texts.$property") }} +{{ ctrans("texts.$property") }} + /
@@ -27,4 +28,4 @@
- \ No newline at end of file + diff --git a/resources/views/portal/ninja2020/auth/register.blade.php b/resources/views/portal/ninja2020/auth/register.blade.php index 4e57cc1e30a4..cd4215f73ef3 100644 --- a/resources/views/portal/ninja2020/auth/register.blade.php +++ b/resources/views/portal/ninja2020/auth/register.blade.php @@ -28,11 +28,15 @@ - {{ ctrans('texts.i_agree') }} + {{ ctrans('texts.i_agree_to_the') }} @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_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') +

{{ $message }}

+ @enderror