installer fixes; user's name

This commit is contained in:
Nabeel Shahzad 2017-12-31 12:09:23 -06:00
parent e73440d081
commit 2c53f091b9
6 changed files with 44 additions and 13 deletions

View File

@ -90,10 +90,8 @@ deploy-package:
.PHONY: reset-installer
reset-installer:
@cp .env.dev.example .env
@make clean
mysql -uroot -e "DROP DATABASE IF EXISTS phpvms"
mysql -uroot -e "CREATE DATABASE phpvms"
@php artisan database:create --reset
@php artisan migrate:refresh --seed
.PHONY: docker
docker:

View File

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

View File

@ -2,6 +2,10 @@
namespace App\Console\Commands;
use App\Models\Airline;
use App\Models\Permission;
use App\Models\Role;
use App\Models\User;
use App\Services\DatabaseService;
use DB;
@ -28,8 +32,8 @@ class DevCommands extends BaseCommand
$commands = [
'clear-acars' => 'clearAcars',
'clear-users' => 'clearUsers',
'compile-assets' => 'compileAssets',
'test-api' => 'testApi',
];
if(!array_key_exists($command, $commands)) {
@ -59,6 +63,26 @@ class DevCommands extends BaseCommand
$this->info('ACARS and PIREPs cleared!');
}
/**
* Delete all the data from the ACARS and PIREP tables
*/
protected function clearUsers()
{
if (config('database.default') === 'mysql') {
DB::statement('SET foreign_key_checks=0');
}
DB::statement('TRUNCATE `role_user`');
Airline::truncate();
User::truncate();
if (config('database.default') === 'mysql') {
DB::statement('SET foreign_key_checks=1');
}
$this->info('Users cleared!');
}
/**
* Compile all the CSS/JS assets into their respective files
* Calling the webpack compiler

View File

@ -217,6 +217,7 @@ class InstallerController extends AppBaseController
$validator = Validator::make($request->all(), [
'airline_name' => 'required',
'airline_icao' => 'required|unique:airlines,icao',
'name' => 'required',
'email' => 'required|email|unique:users,email',
'password' => 'required|confirmed'
]);
@ -259,9 +260,7 @@ class InstallerController extends AppBaseController
Log::info('User registered: ', $user->toArray());
# Set the intial admin e-mail address
$admin_email = Setting::where('key', 'general.admin_email');
$admin_email->value = $user->email;
$admin_email->save();
setting('general.admin_email', $user->email);
return view('installer::steps/step3a-completed', []);
}

View File

@ -36,7 +36,17 @@
</tr>
<tr>
<td><p>Admin Email</p></td>
<td><p>Name</p></td>
<td>
<div class="form-group">
{!! Form::input('text', 'name', null, ['class' => 'form-control']) !!}
@include('installer::flash/check_error', ['field' => 'name'])
</div>
</td>
</tr>
<tr>
<td><p>Email</p></td>
<td>
<div class="form-group">
{!! Form::input('text', 'email', null, ['class' => 'form-control']) !!}

View File

@ -30,9 +30,9 @@ DB_PREFIX=
MAIL_DRIVER=smtp
MAIL_FROM_ADDRESS=no-reply@phpvms.net
MAIL_FROM_NAME="phpVMS Admin"
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_ENCRYPTION=tls
MAIL_HOST=
MAIL_PORT=
MAIL_ENCRYPTION=
MAIL_USERNAME=
MAIL_PASSWORD=