Cleanup registration and add a generic TOC

This commit is contained in:
Nabeel Shahzad 2017-12-23 08:21:40 -06:00
parent e895501ca7
commit 014aea6ae1
4 changed files with 125 additions and 49 deletions

View File

@ -1,5 +1,5 @@
dnsmasq: /usr/local/sbin/dnsmasq --keep-in-foreground dnsmasq: /usr/local/sbin/dnsmasq --keep-in-foreground
php-fpm: /usr/local/sbin/php-fpm --nodaemonize php-fpm: /usr/local/sbin/php-fpm --nodaemonize
nginx: /usr/local/bin/nginx nginx: /usr/local/bin/nginx
mysql: /usr/local/bin/mysqld #mysql: /usr/local/bin/mysqld
mailhog: /usr/local/bin/mailhog mailhog: /usr/local/bin/mailhog

View File

@ -2,18 +2,21 @@
namespace App\Http\Controllers\Auth; namespace App\Http\Controllers\Auth;
use App\Models\Enums\PilotState;
use Log; use Log;
use App\Facades\Utils;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Validator; use Validator;
use Illuminate\Support\Facades\Hash;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\Request;
use App\Models\User;
use App\Facades\Utils;
use App\Models\Airport; use App\Models\Airport;
use App\Models\Airline; use App\Models\Airline;
use App\Services\UserService; use App\Services\UserService;
use App\Models\Enums\PilotState;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\RegistersUsers; use App\Repositories\AirlineRepository;
use Illuminate\Http\Request; use App\Repositories\AirportRepository;
class RegisterController extends Controller class RegisterController extends Controller
{ {
@ -26,20 +29,27 @@ class RegisterController extends Controller
*/ */
protected $redirectTo = '/'; protected $redirectTo = '/';
protected $userService; protected $airlineRepo,
$airportRepo,
$userService;
public function __construct( public function __construct(
AirlineRepository $airlineRepo,
AirportRepository $airportRepo,
UserService $userService UserService $userService
) { ) {
$this->airlineRepo = $airlineRepo;
$this->airportRepo = $airportRepo;
$this->userService = $userService; $this->userService = $userService;
$this->middleware('guest'); $this->middleware('guest');
} }
public function showRegistrationForm() public function showRegistrationForm()
{ {
$airports = Airport::all(); $airports = $this->airportRepo->selectBoxList();
$airlines = Airline::all(); $airlines = $this->airlineRepo->selectBoxList();
return $this->view('auth.register', [ return $this->view('auth.register', [
'airports' => $airports, 'airports' => $airports,
'airlines' => $airlines, 'airlines' => $airlines,
@ -57,8 +67,8 @@ class RegisterController extends Controller
return Validator::make($data, [ return Validator::make($data, [
'name' => 'required|max:255', 'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users', 'email' => 'required|email|max:255|unique:users',
'airline' => 'required', 'airline_id' => 'required',
'home_airport' => 'required', 'home_airport_id' => 'required',
'password' => 'required|min:5|confirmed', 'password' => 'required|min:5|confirmed',
]); ]);
} }
@ -76,9 +86,9 @@ class RegisterController extends Controller
'name' => $data['name'], 'name' => $data['name'],
'email' => $data['email'], 'email' => $data['email'],
'api_key' => Utils::generateApiKey(), 'api_key' => Utils::generateApiKey(),
'airline_id' => $data['airline'], 'airline_id' => $data['airline_id'],
'home_airport_id' => $data['home_airport'], 'home_airport_id' => $data['home_airport_id'],
'curr_airport_id' => $data['home_airport'], 'curr_airport_id' => $data['home_airport_id'],
'password' => Hash::make($data['password']) 'password' => Hash::make($data['password'])
]; ];
@ -99,8 +109,8 @@ class RegisterController extends Controller
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required', 'name' => 'required',
'email' => 'required|unique:users|email', 'email' => 'required|unique:users|email',
'airline' => 'required', 'airline_id' => 'required',
'home_airport' => 'required', 'home_airport_id' => 'required',
'password' => 'required|confirmed' 'password' => 'required|confirmed'
]); ]);

View File

@ -2,70 +2,67 @@
@section('title', 'register') @section('title', 'register')
@section('content') @section('content')
<div class="row"> <div class="row">
<div class="col-sm-4"></div> <div class="col-sm-3"></div>
<div class="col-sm-4"> <div class="col-sm-6">
<form class="form-signin" role="form" method="POST" action="{{ url('/register') }}">
{{ csrf_field() }} {!! Form::open(['url' => '/register', 'class' => 'form-signin']) !!}
<div class="panel periodic-login"> <div class="panel periodic-login">
<div class="panel-body text-center"> <div class="panel-body">
<h4>Register</h4> <h2>Register</h2>
<label for="name" class="col-md-4 control-label">Full Name</label> <label for="name" class="control-label">Full Name</label>
<div class="input-group form-group-no-border{{ $errors->has('name') ? ' has-danger' : '' }}"> <div class="input-group form-group-no-border{{ $errors->has('name') ? ' has-danger' : '' }}">
<input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" placeholder="Full Name" required> {!! Form::text('name', null, ['class' => 'form-control']) !!}
</div> </div>
@if ($errors->has('name')) @if ($errors->has('name'))
<p class="text-danger">{{ $errors->first('name') }}</p> <p class="text-danger">{{ $errors->first('name') }}</p>
@endif @endif
<label for="email" class="col-md-4 control-label">Email Address</label> <label for="email" class="control-label">Email Address</label>
<div class="input-group form-group-no-border{{ $errors->has('email') ? ' has-danger' : '' }}"> <div class="input-group form-group-no-border{{ $errors->has('email') ? ' has-danger' : '' }}">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" placeholder="Email Address" required> {!! Form::text('email', null, ['class' => 'form-control']) !!}
</div> </div>
@if ($errors->has('email')) @if ($errors->has('email'))
<p class="text-danger">{{ $errors->first('email') }}</p> <p class="text-danger">{{ $errors->first('email') }}</p>
@endif @endif
<label for="airline" class="col-md-4 control-label">Airline</label> <label for="airline" class="control-label">Airline</label>
<div class="input-group form-group-no-border{{ $errors->has('airline') ? ' has-danger' : '' }}"> <div class="input-group form-group-no-border{{ $errors->has('airline') ? ' has-danger' : '' }}">
<select name="airline" id="airline" class="form-control" required> {!! Form::select('airline_id', $airlines, null , ['class' => 'form-control select2']) !!}
@foreach($airlines as $airline)
<option value="{{ $airline->id }}">{{ $airline->code }} - {{ $airline->name }}</option>
@endforeach
</select>
</div> </div>
@if ($errors->has('airline')) @if ($errors->has('airline_id'))
<p class="text-danger">{{ $errors->first('airline') }}</p> <p class="text-danger">{{ $errors->first('airline_id') }}</p>
@endif @endif
<label for="home_airport" class="col-md-4 control-label">Home Airport</label> <label for="home_airport" class="control-label">Home Airport</label>
<div class="input-group form-group-no-border{{ $errors->has('home_airport') ? ' has-danger' : '' }}"> <div class="input-group form-group-no-border{{ $errors->has('home_airport') ? ' has-danger' : '' }}">
<select name="home_airport" id="home_airport" class="form-control" required> {!! Form::select('home_airport_id', $airlines, null , ['class' => 'form-control select2']) !!}
@foreach($airports as $airport)
<option value="{{ $airport->id }}">{{ $airport->icao }} - {{ $airport->name }}</option>
@endforeach
</select>
</div> </div>
@if ($errors->has('home_airport')) @if ($errors->has('home_airport_id'))
<p class="text-danger">{{ $errors->first('home_airport') }}</p> <p class="text-danger">{{ $errors->first('home_airport_id') }}</p>
@endif @endif
<label for="password" class="col-md-4 control-label">Password</label> <label for="password" class="control-label">Password</label>
<div class="input-group form-group-no-border{{ $errors->has('password') ? ' has-danger' : '' }}"> <div class="input-group form-group-no-border{{ $errors->has('password') ? ' has-danger' : '' }}">
<input id="password" type="password" class="form-control" name="password" value="" placeholder="Password" required> {!! Form::password('password', ['class' => 'form-control']) !!}
</div> </div>
@if ($errors->has('password')) @if ($errors->has('password'))
<p class="text-danger">{{ $errors->first('password') }}</p> <p class="text-danger">{{ $errors->first('password') }}</p>
@endif @endif
<label for="password_confirmation" class="col-md-4 control-label">Confirm Password</label> <label for="password_confirmation" class="control-label">Confirm Password</label>
<div class="input-group form-group-no-border{{ $errors->has('password_confirmation') ? ' has-danger' : '' }}"> <div class="input-group form-group-no-border{{ $errors->has('password_confirmation') ? ' has-danger' : '' }}">
<input id="password_confirmation" type="password" class="form-control" name="password_confirmation" value="" placeholder="Confirm Password" required> {!! Form::password('password_confirmation', ['class' => 'form-control']) !!}
</div> </div>
@if ($errors->has('password_confirmation')) @if ($errors->has('password_confirmation'))
<p class="text-danger">{{ $errors->first('password_confirmation') }}</p> <p class="text-danger">{{ $errors->first('password_confirmation') }}</p>
@endif @endif
<button type="submit" class="btn btn-primary">Register</button>
@include('layouts.default.auth.toc')
<div style="width: 100%; text-align: right; padding-top: 20px;">
By registering, you agree to the Term and Conditions<br /><br />
{!! Form::submit('Register!', ['class' => 'btn btn-primary']) !!}
</div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,69 @@
<h4>Terms and Conditions</h4>
<textarea class="form-control" style="height: 150px; border: 1px #ccc solid;">
{!! config('app.name') !!} offers this Web site, including all information, software,
products and services available from this Web site or offered as part of or in conjunction
with this Web site (the “Web site”), to you, the user, conditioned upon your acceptance of
all of the terms, conditions, policies and notices stated here. {!! config('app.name') !!}
reserves the right to make changes to these Terms and Conditions immediately by posting the
changed Terms and Conditions in this location.
Your continued use of the Web site constitutes your agreement to all such terms, conditions
and notices, and any changes to the Terms and Conditions made by {!! config('app.name') !!}.
The term genericwebsite.com or us or we refers to the owner of the website. The term
you refers to the user or viewer of our website.
The use of this website is subject to the following terms of use:
Use the website at your own risk. This website is provided to you “as is, without warranty
of any kind either express or implied. Neither {!! config('app.name') !!} nor its employees,
agents, third-party information providers, merchants, licensors or the like warrant that the
Web site or its operation will be accurate, reliable, uninterrupted or error-free. No agent
or representative has the authority to create any warranty regarding the Web site on behalf
of {!! config('app.name') !!}. {!! config('app.name') !!} reserves the right to change or
discontinue at any time any aspect or feature of the Web site.
Exclusion of Liability
The content of the pages of this website is for your general information and use only. It is
subject to change without notice.
Neither we nor any third parties provide any warranty or guarantee as to the accuracy,
timeliness, performance, completeness or suitability of the information and materials found or
offered on this website for any particular purpose. You acknowledge that such information and
materials may contain inaccuracies or errors and we expressly exclude liability for any such
inaccuracies or errors to the fullest extent permitted by law.
Indemnification
Your use of any information or materials on this website is entirely at your own risk, for which
we shall not be liable. It shall be your own responsibility to ensure that any products, services
or information available through this website meet your specific requirements.
This website contains material which is owned by or licensed to us. This material includes, but is
not limited to, the design, layout, look, appearance and graphics. Reproduction is prohibited other
than in accordance with the copyright notice, which forms part of these terms and conditions.
All trade marks reproduced in this website which are not the property of, or licensed to, the
operator are acknowledged on the website.
Unauthorized use of this website may give rise to a claim for damages and/or be a criminal offense.
From time to time this website may also include links to other websites. These links are provided
for your convenience to provide further information. They do not signify that we endorse the
website(s). We have no responsibility for the content of the linked website(s).
Copyright
Except for material in the public domain under United States copyright law, all material contained
on the Web site (including all software, HTML code, Java applets, Active X controls and other code)
is protected by United States and foreign copyright laws. Except as otherwise expressly provided
in these terms and conditions, you may not copy, distribute, transmit, display, perform, reproduce,
publish, license, modify, rewrite, create derivative works from, transfer, or sell any material
contained on the Web site without the prior consent of the copyright owner.
None of the material contained on {!! config('app.name') !!} may be reverse-engineered, disassembled,
decompiled, transcribed, stored in a retrieval system, translated into any language or computer language,
retransmitted in any form or by any means (electronic, mechanical, photo reproduction, recordation or
otherwise), resold or redistributed without the prior written consent of {!! config('app.name') !!}.
Violation of this provision may result in severe civil and criminal penalties.
</textarea>