Use two checkboxes for terms/privacy

This commit is contained in:
Hillel Coren 2018-05-08 21:47:41 +03:00
parent d0ad4d21c7
commit 4bd2b22bcb
4 changed files with 16 additions and 7 deletions

View File

@ -399,7 +399,7 @@ class UserController extends BaseController
$referer = Request::server('HTTP_REFERER');
$message = '';
if (request()->accepted_terms) {
if (request()->accepted_terms && request()->accepted_privacy) {
auth()->user()->acceptLatestTerms($ip)->save();
$message = trans('texts.accepted_terms');
}

View File

@ -260,7 +260,7 @@ $LANG = array(
'cvv' => 'CVV',
'logout' => 'Log Out',
'sign_up_to_save' => 'Sign up to save your work',
'agree_to_terms' => 'I agree to the Invoice Ninja :terms',
'agree_to_terms' => 'I agree to the :terms',
'terms_of_service' => 'Terms of Service',
'email_taken' => 'The email address is already registered',
'working' => 'Working',

View File

@ -1,5 +1,6 @@
{!! Former::open('/accept_terms')->id('acceptTermsForm')->rules([
'accepted_terms' => 'required',
'accepted_privacy' => 'required',
]) !!}
<div class="modal fade" id="acceptTermsModal" tabindex="-1" role="dialog"
@ -15,7 +16,9 @@
<div class="panel-body">
{!! Former::checkbox('accepted_terms')->text(trans('texts.agree_to_terms', [
'terms' => link_to(Utils::getTermsLink(), trans('texts.terms_of_service'), ['target' => '_blank']),
'privacy' => link_to(Utils::getPrivacyLink(), trans('texts.privacy_policy'), ['target' => '_blank']),
]))->raw()->value(1) !!}
{!! Former::checkbox('accepted_privacy')->text(trans('texts.agree_to_terms', [
'terms' => link_to(Utils::getPrivacyLink(), trans('texts.privacy_policy'), ['target' => '_blank']),
]))->raw()->value(1) !!}
</div>
</div>

View File

@ -27,8 +27,8 @@ $(function() {
// Ensure terms is checked for sign up form
@if (Auth::check())
setSignupEnabled(false);
$("#terms_checkbox").change(function() {
setSignupEnabled(this.checked);
$("#terms_checkbox, #privacy_checkbox").change(function() {
setSignupEnabled($('#terms_checkbox').is(':checked') && $('#privacy_checkbox').is(':checked'));
});
@endif
@ -87,7 +87,7 @@ function validateSignUp(showError) {
}
});
if (!$('#terms_checkbox').is(':checked')) {
if (! $('#terms_checkbox').is(':checked') || ! $('#privacy_checkbox').is(':checked')) {
isFormValid = false;
}
@ -194,9 +194,15 @@ function handleSignedUp() {
->value(1)
->text(trans('texts.agree_to_terms', [
'terms' => link_to(Utils::getTermsLink(), trans('texts.terms_of_service'), ['target' => '_blank']),
'privacy' => link_to(Utils::getTermsLink(), trans('texts.privacy_policy'), ['target' => '_blank']),
]))
->raw() !!}
{!! Former::checkbox('privacy_checkbox')
->label(' ')
->value(1)
->text(trans('texts.agree_to_terms', [
'terms' => link_to(Utils::getTermsLink(), trans('texts.privacy_policy'), ['target' => '_blank']),
]))
->raw() !!}
<br/>
</div>
<br/>&nbsp;<br/>