Add explicit TOC accepted checkbox #244

This commit is contained in:
Nabeel Shahzad
2018-09-20 11:14:18 -05:00
parent fbcaa382f4
commit ab5480fdc9
6 changed files with 65 additions and 4 deletions
@@ -32,6 +32,7 @@ class CreateUsersTable extends Migration
$table->string('timezone', 64)->nullable(); $table->string('timezone', 64)->nullable();
$table->unsignedTinyInteger('status')->nullable()->default(0); $table->unsignedTinyInteger('status')->nullable()->default(0);
$table->unsignedTinyInteger('state')->nullable()->default(0); $table->unsignedTinyInteger('state')->nullable()->default(0);
$table->boolean('toc_accepted')->nullable();
$table->boolean('opt_in')->nullable(); $table->boolean('opt_in')->nullable();
$table->boolean('active')->nullable(); $table->boolean('active')->nullable();
$table->ipAddress('last_ip')->nullable(); $table->ipAddress('last_ip')->nullable();
+6
View File
@@ -25,6 +25,8 @@ users:
flight_time: 0 flight_time: 0
timezone: America/Chicago timezone: America/Chicago
state: 1 state: 1
opt_in: 1
toc_accepted: 1
created_at: now created_at: now
updated_at: now updated_at: now
- id: 2 - id: 2
@@ -41,6 +43,8 @@ users:
created_at: now created_at: now
updated_at: now updated_at: now
state: 0 state: 0
opt_in: 1
toc_accepted: 1
- id: 3 - id: 3
name: Raymond Pearson name: Raymond Pearson
email: raymond.pearson56@example.com email: raymond.pearson56@example.com
@@ -55,6 +59,8 @@ users:
created_at: now created_at: now
updated_at: now updated_at: now
state: 1 state: 1
opt_in: 0
toc_accepted: 1
role_user: role_user:
- user_id: 1 - user_id: 1
@@ -86,6 +86,7 @@ class RegisterController extends Controller
'airline_id' => 'required', 'airline_id' => 'required',
'home_airport_id' => 'required', 'home_airport_id' => 'required',
'password' => 'required|min:5|confirmed', 'password' => 'required|min:5|confirmed',
'toc_accepted' => 'accepted',
]; ];
if (config('captcha.enabled')) { if (config('captcha.enabled')) {
@@ -117,7 +118,7 @@ class RegisterController extends Controller
// Convert transfer hours into minutes // Convert transfer hours into minutes
if (isset($opts['transfer_time'])) { if (isset($opts['transfer_time'])) {
$opts['transfer_time'] = $opts['transfer_time'] * 60; $opts['transfer_time'] *= 60;
} }
$user = User::create($opts); $user = User::create($opts);
@@ -148,6 +149,7 @@ class RegisterController extends Controller
'timezone' => 'required', 'timezone' => 'required',
'country' => 'required', 'country' => 'required',
'transfer_time' => 'integer|min:0', 'transfer_time' => 'integer|min:0',
'toc_accepted' => 'accepted',
]; ];
if (config('captcha.enabled')) { if (config('captcha.enabled')) {
+2
View File
@@ -62,6 +62,7 @@ class User extends Authenticatable
'timezone', 'timezone',
'state', 'state',
'status', 'status',
'toc_accepted',
'opt_in', 'opt_in',
'created_at', 'created_at',
'updated_at', 'updated_at',
@@ -83,6 +84,7 @@ class User extends Authenticatable
'balance' => 'double', 'balance' => 'double',
'state' => 'integer', 'state' => 'integer',
'status' => 'integer', 'status' => 'integer',
'toc_accepted' => 'boolean',
'opt_in' => 'boolean', 'opt_in' => 'boolean',
]; ];
@@ -111,6 +111,10 @@
<td>Last Login</td> <td>Last Login</td>
<td>{{ show_datetime($user->updated_at) }}</td> <td>{{ show_datetime($user->updated_at) }}</td>
</tr> </tr>
<tr>
<td>@lang('toc.title')</td>
<td>{{ $user->toc_accepted ? __('common.yes') : __('common.no') }}</td>
</tr>
<tr> <tr>
<td>@lang('profile.opt-in')</td> <td>@lang('profile.opt-in')</td>
<td>{{ $user->opt_in ? __('common.yes') : __('common.no') }}</td> <td>{{ $user->opt_in ? __('common.yes') : __('common.no') }}</td>
@@ -95,11 +95,45 @@
@endif @endif
@endif @endif
@include('auth.toc') <div>
@include('auth.toc')
<br />
</div>
<table>
<tr>
<td style="vertical-align: top; padding: 5px 10px 0 0">
<div class="input-group form-group-no-border">
{{ Form::hidden('toc_accepted', 0, false) }}
{{ Form::checkbox('toc_accepted', 1, null, ['id' => 'toc_accepted']) }}
</div>
</td>
<td style="vertical-align: top;">
<label for="toc_accepted" class="control-label">@lang('auth.tocaccept')</label>
@if ($errors->has('toc_accepted'))
<p class="text-danger">{{ $errors->first('toc_accepted') }}</p>
@endif
</td>
</tr>
<tr>
<td>
<div class="input-group form-group-no-border">
{{ Form::hidden('opt_in', 0, false) }}
{{ Form::checkbox('opt_in', 1, null) }}
</div>
</td>
<td>
<label for="opt_in" class="control-label">@lang('profile.opt-in-descrip')</label>
</td>
</tr>
</table>
<div style="width: 100%; text-align: right; padding-top: 20px;"> <div style="width: 100%; text-align: right; padding-top: 20px;">
@lang('auth.tocaccept')<br /><br /> {{ Form::submit(__('auth.register'), [
{{ Form::submit(__('auth.register'), ['class' => 'btn btn-primary']) }} 'id' => 'register_button',
'class' => 'btn btn-primary',
'disabled' => true,
]) }}
</div> </div>
</div> </div>
@@ -112,4 +146,16 @@
@section('scripts') @section('scripts')
{!! NoCaptcha::renderJs(config('app.locale')) !!} {!! NoCaptcha::renderJs(config('app.locale')) !!}
<script>
$('#toc_accepted').click(function () {
if ($(this).is(':checked')) {
console.log('toc accepted');
$('#register_button').removeAttr('disabled');
} else {
console.log('toc not accepted');
$('#register_button').attr('disabled', 'true');
}
});
</script>
@endsection @endsection