diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 9a2ce27..2fd0b67 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -29,12 +29,14 @@ protected function schedule(Schedule $schedule) } /** - * Register the Closure based commands for the application. + * Register the commands for the application. * * @return void */ protected function commands() { + $this->load(__DIR__.'/Commands'); + require base_path('routes/console.php'); } } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index a747e31..7e2563a 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -3,23 +3,27 @@ namespace App\Exceptions; use Exception; -use Illuminate\Auth\AuthenticationException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; class Handler extends ExceptionHandler { /** - * A list of the exception types that should not be reported. + * A list of the exception types that are not reported. * * @var array */ protected $dontReport = [ - \Illuminate\Auth\AuthenticationException::class, - \Illuminate\Auth\Access\AuthorizationException::class, - \Symfony\Component\HttpKernel\Exception\HttpException::class, - \Illuminate\Database\Eloquent\ModelNotFoundException::class, - \Illuminate\Session\TokenMismatchException::class, - \Illuminate\Validation\ValidationException::class, + // + ]; + + /** + * A list of the inputs that are never flashed for validation exceptions. + * + * @var array + */ + protected $dontFlash = [ + 'password', + 'password_confirmation', ]; /** @@ -46,20 +50,4 @@ public function render($request, Exception $exception) { return parent::render($request, $exception); } - - /** - * Convert an authentication exception into an unauthenticated response. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Auth\AuthenticationException $exception - * @return \Illuminate\Http\Response - */ - protected function unauthenticated($request, AuthenticationException $exception) - { - if ($request->expectsJson()) { - return response()->json(['error' => 'Unauthenticated.'], 401); - } - - return redirect()->guest(route('login')); - } } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 66d34c3..93bf68b 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -18,6 +18,7 @@ class Kernel extends HttpKernel \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, + \App\Http\Middleware\TrustProxies::class, ]; /** diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index 3aa15f8..033136a 100644 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -2,9 +2,9 @@ namespace App\Http\Middleware; -use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter; +use Illuminate\Cookie\Middleware\EncryptCookies as Middleware; -class EncryptCookies extends BaseEncrypter +class EncryptCookies extends Middleware { /** * The names of the cookies that should not be encrypted. diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php index 943e9a4..5a50e7b 100644 --- a/app/Http/Middleware/TrimStrings.php +++ b/app/Http/Middleware/TrimStrings.php @@ -2,9 +2,9 @@ namespace App\Http\Middleware; -use Illuminate\Foundation\Http\Middleware\TrimStrings as BaseTrimmer; +use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware; -class TrimStrings extends BaseTrimmer +class TrimStrings extends Middleware { /** * The names of the attributes that should not be trimmed. diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php new file mode 100644 index 0000000..ef1c00d --- /dev/null +++ b/app/Http/Middleware/TrustProxies.php @@ -0,0 +1,29 @@ + 'FORWARDED', + Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR', + Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST', + Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT', + Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO', + ]; +} diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index a2c3541..0c13b85 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -2,9 +2,9 @@ namespace App\Http\Middleware; -use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier; +use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; -class VerifyCsrfToken extends BaseVerifier +class VerifyCsrfToken extends Middleware { /** * The URIs that should be excluded from CSRF verification. diff --git a/artisan b/artisan index 44dc07b..5c23e2e 100755 --- a/artisan +++ b/artisan @@ -1,6 +1,8 @@ #!/usr/bin/env php =5.6.4", + "php": ">=7.0.0", + "fideloper/proxy": "~3.3", "kordy/ticketit": "0.*", - "laravel/framework": "5.4.*", + "laravel/framework": "5.5.*", "laravel/tinker": "~1.0" }, "require-dev": { + "filp/whoops": "~2.0", "fzaninotto/faker": "~1.4", "mockery/mockery": "0.9.*", - "phpunit/phpunit": "~5.7" + "phpunit/phpunit": "~6.0" }, "autoload": { "classmap": [ - "database" + "database/seeds", + "database/factories" ], "psr-4": { "App\\": "app/" @@ -28,20 +31,22 @@ "Tests\\": "tests/" } }, + "extra": { + "laravel": { + "dont-discover": [ + ] + } + }, "scripts": { "post-root-package-install": [ - "php -r \"file_exists('.env') || copy('.env.example', '.env');\"" + "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ - "php artisan key:generate" - ], - "post-install-cmd": [ - "Illuminate\\Foundation\\ComposerScripts::postInstall", - "php artisan optimize" + "@php artisan key:generate" ], - "post-update-cmd": [ - "Illuminate\\Foundation\\ComposerScripts::postUpdate", - "php artisan optimize" + "post-autoload-dump": [ + "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", + "@php artisan package:discover" ] }, "config": { diff --git a/config/app.php b/config/app.php index a53aa77..eba278d 100644 --- a/config/app.php +++ b/config/app.php @@ -10,6 +10,7 @@ | This value is the name of your application. This value is used when the | framework needs to place the application's name in a notification or | any other location as required by the application or its packages. + | */ 'name' => 'Ticketit', @@ -166,7 +167,6 @@ /* * Package Service Providers... */ - Laravel\Tinker\TinkerServiceProvider::class, //Kordy\Ticketit\TicketitServiceProvider::class, /* diff --git a/config/session.php b/config/session.php index e2779ad..71ad0ed 100644 --- a/config/session.php +++ b/config/session.php @@ -122,7 +122,10 @@ | */ - 'cookie' => 'laravel_session', + 'cookie' => env( + 'SESSION_COOKIE', + str_slug(env('APP_NAME', 'laravel'), '_').'_session' + ), /* |-------------------------------------------------------------------------- @@ -176,4 +179,19 @@ 'http_only' => true, + /* + |-------------------------------------------------------------------------- + | Same-Site Cookies + |-------------------------------------------------------------------------- + | + | This option determines how your cookies behave when cross-site requests + | take place, and can be used to mitigate CSRF attacks. By default, we + | do not enable this as other CSRF protection services are in place. + | + | Supported: "lax", "strict" + | + */ + + 'same_site' => null, + ]; diff --git a/database/factories/ModelFactory.php b/database/factories/UserFactory.php similarity index 55% rename from database/factories/ModelFactory.php rename to database/factories/UserFactory.php index 7926c79..061d75a 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/UserFactory.php @@ -1,18 +1,19 @@ define(App\User::class, function (Faker\Generator $faker) { +$factory->define(App\User::class, function (Faker $faker) { static $password; return [ diff --git a/package.json b/package.json index 630a244..dedcbef 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,21 @@ { - "private": true, - "scripts": { - "dev": "npm run development", - "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", - "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", - "watch-poll": "npm run watch -- --watch-poll", - "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", - "prod": "npm run production", - "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" - }, - "devDependencies": { - "axios": "^0.16.2", - "bootstrap-sass": "^3.3.7", - "cross-env": "^5.0.1", - "jquery": "^3.1.1", - "laravel-mix": "^1.0", - "lodash": "^4.17.4", - "vue": "^2.1.10" - } + "private": true, + "scripts": { + "dev": "npm run development", + "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "watch-poll": "npm run watch -- --watch-poll", + "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", + "prod": "npm run production", + "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" + }, + "devDependencies": { + "axios": "^0.16.2", + "bootstrap-sass": "^3.3.7", + "cross-env": "^5.0.1", + "jquery": "^3.1.1", + "laravel-mix": "^1.0", + "lodash": "^4.17.4", + "vue": "^2.1.10" + } } diff --git a/phpunit.xml b/phpunit.xml index 9ecda83..bb9c4a7 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,7 +1,7 @@ */ +define('LARAVEL_START', microtime(true)); + /* |-------------------------------------------------------------------------- | Register The Auto Loader @@ -19,7 +21,7 @@ | */ -require __DIR__.'/../bootstrap/autoload.php'; +require __DIR__.'/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- diff --git a/resources/assets/sass/app.scss b/resources/assets/sass/app.scss index 63633fc..1bbc550 100644 --- a/resources/assets/sass/app.scss +++ b/resources/assets/sass/app.scss @@ -6,4 +6,4 @@ @import "variables"; // Bootstrap -@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; +@import "~bootstrap-sass/assets/stylesheets/bootstrap"; diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index ea11673..817ba4a 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -8,6 +8,7 @@
Login
+
{{ csrf_field() }} diff --git a/resources/views/auth/passwords/email.blade.php b/resources/views/auth/passwords/email.blade.php index 3b1272f..82cf3bc 100644 --- a/resources/views/auth/passwords/email.blade.php +++ b/resources/views/auth/passwords/email.blade.php @@ -8,6 +8,7 @@
Reset Password
+
@if (session('status'))
diff --git a/resources/views/auth/passwords/reset.blade.php b/resources/views/auth/passwords/reset.blade.php index 29f815b..b20b623 100644 --- a/resources/views/auth/passwords/reset.blade.php +++ b/resources/views/auth/passwords/reset.blade.php @@ -10,12 +10,6 @@
Reset Password
- @if (session('status')) -
- {{ session('status') }} -
- @endif - {{ csrf_field() }} diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 499d5a5..3bbbbe9 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -8,6 +8,7 @@
Register
+
{{ csrf_field() }} diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index df6c334..941effe 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -1,5 +1,5 @@ - + @@ -42,7 +42,7 @@ - @endif + @endguest
diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index d42efe6..265e6c2 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -73,17 +73,17 @@
@if (Route::has('login')) @endif
-
+
{{ config('app.name') }} {{-- This is not nice --}} {{-- However probably the first you'll do after install, --}} diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php index 486dc27..f31e495 100644 --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -3,9 +3,7 @@ namespace Tests\Feature; use Tests\TestCase; -use Illuminate\Foundation\Testing\WithoutMiddleware; -use Illuminate\Foundation\Testing\DatabaseMigrations; -use Illuminate\Foundation\Testing\DatabaseTransactions; +use Illuminate\Foundation\Testing\RefreshDatabase; class ExampleTest extends TestCase { diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php index 5663bb4..e9fe19c 100644 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/ExampleTest.php @@ -3,8 +3,7 @@ namespace Tests\Unit; use Tests\TestCase; -use Illuminate\Foundation\Testing\DatabaseMigrations; -use Illuminate\Foundation\Testing\DatabaseTransactions; +use Illuminate\Foundation\Testing\RefreshDatabase; class ExampleTest extends TestCase {