diff --git a/.env.example b/.env.example new file mode 100644 index 000000000..031862bef --- /dev/null +++ b/.env.example @@ -0,0 +1,23 @@ +APP_ENV=local +APP_DEBUG=true +APP_KEY=SomeRandomString + +DB_HOST=localhost +DB_DATABASE=homestead +DB_USERNAME=homestead +DB_PASSWORD=secret + +CACHE_DRIVER=file +SESSION_DRIVER=file +QUEUE_DRIVER=sync + +REDIS_HOST=localhost +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_DRIVER=smtp +MAIL_HOST=mailtrap.io +MAIL_PORT=2525 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 25db83ae8..1ef91c60c 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -10,6 +10,9 @@ use AccountNotFoundException; use Illuminate\Database\Eloquent\ModelNotFoundException; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Illuminate\Auth\Access\AuthorizationException; +use Illuminate\Foundation\Validation\ValidationException; + use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; class Handler extends ExceptionHandler @@ -22,6 +25,8 @@ class Handler extends ExceptionHandler protected $dontReport = [ HttpException::class, ModelNotFoundException::class, + ValidationException::class, + AuthorizationException::class, ]; /** diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 8c5ac77c8..29f3e7a91 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -36,13 +36,6 @@ class AuthController extends Controller */ protected $redirectPath = '/'; - /** - * Failed post-authentication redirect location. - * - * @var string - */ - protected $loginPath = '/auth/login'; - /** * Lockout time for failed login requests. * diff --git a/composer.json b/composer.json index 052e8cc2c..d55c12e02 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "type": "project", "require": { "php": ">=5.5.9", - "laravel/framework": "5.1.*", + "laravel/framework": "5.2.*", "barryvdh/laravel-debugbar": "^2.0", "doctrine/dbal": "^2.5", "guzzlehttp/guzzle": "^6.1", @@ -20,7 +20,9 @@ "fzaninotto/faker": "~1.4", "mockery/mockery": "0.9.*", "phpunit/phpunit": "~4.0", - "phpspec/phpspec": "~2.1" + "phpspec/phpspec": "~2.1", + "symfony/css-selector": "~3.0", + "symfony/dom-crawler": "~3.0" }, "autoload": { "classmap": [ @@ -40,8 +42,9 @@ "php artisan clear-compiled", "php artisan optimize" ], - "pre-update-cmd": [ - "php artisan clear-compiled" + "post-autoload-dump": [ + "php artisan clear-compiled", + "php artisan optimize" ], "post-update-cmd": [ "php artisan optimize" diff --git a/config/app.php b/config/app.php index 668777b40..8a0635393 100644 --- a/config/app.php +++ b/config/app.php @@ -2,6 +2,8 @@ return [ + 'env' => env('APP_ENV', 'production'), + /* |-------------------------------------------------------------------------- | Application Debug Mode @@ -113,13 +115,11 @@ return [ /* * Laravel Framework Service Providers... */ - Illuminate\Foundation\Providers\ArtisanServiceProvider::class, Illuminate\Auth\AuthServiceProvider::class, Illuminate\Broadcasting\BroadcastServiceProvider::class, Illuminate\Bus\BusServiceProvider::class, Illuminate\Cache\CacheServiceProvider::class, Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, - Illuminate\Routing\ControllerServiceProvider::class, Illuminate\Cookie\CookieServiceProvider::class, Illuminate\Database\DatabaseServiceProvider::class, Illuminate\Encryption\EncryptionServiceProvider::class, diff --git a/config/auth.php b/config/auth.php index c91389744..c8c53e14e 100644 --- a/config/auth.php +++ b/config/auth.php @@ -4,64 +4,104 @@ return [ /* |-------------------------------------------------------------------------- - | Default Authentication Driver + | Authentication Defaults |-------------------------------------------------------------------------- | - | This option controls the authentication driver that will be utilized. - | This driver manages the retrieval and authentication of the users - | attempting to get access to protected areas of your application. + | This option controls the default authentication "guard" and password + | reset options for your application. You may change these defaults + | as required, but they're a perfect start for most applications. + | + */ + + 'defaults' => [ + 'guard' => 'web', + 'passwords' => 'users', + ], + + /* + |-------------------------------------------------------------------------- + | Authentication Guards + |-------------------------------------------------------------------------- + | + | Next, you may define every authentication guard for your application. + | Of course, a great default configuration has been defined for you + | here which uses session storage and the Eloquent user provider. + | + | All authentication drivers have a user provider. This defines how the + | users are actually retrieved out of your database or other storage + | mechanisms used by this application to persist your user's data. + | + | Supported: "session", "token" + | + */ + + 'guards' => [ + 'web' => [ + 'driver' => 'session', + 'provider' => 'users', + ], + + 'api' => [ + 'driver' => 'token', + 'provider' => 'users', + ], + ], + + /* + |-------------------------------------------------------------------------- + | User Providers + |-------------------------------------------------------------------------- + | + | All authentication drivers have a user provider. This defines how the + | users are actually retrieved out of your database or other storage + | mechanisms used by this application to persist your user's data. + | + | If you have multiple user tables or models you may configure multiple + | sources which represent each model / table. These sources may then + | be assigned to any extra authentication guards you have defined. | | Supported: "database", "eloquent" | */ - 'driver' => 'eloquent', + 'providers' => [ + 'users' => [ + 'driver' => 'eloquent', + 'model' => Pterodactyl\Models\User::class, + ], + + // 'users' => [ + // 'driver' => 'database', + // 'table' => 'users', + // ], + ], /* |-------------------------------------------------------------------------- - | Authentication Model - |-------------------------------------------------------------------------- - | - | When using the "Eloquent" authentication driver, we need to know which - | Eloquent model should be used to retrieve your users. Of course, it - | is often just the "User" model but you may use whatever you like. - | - */ - - 'model' => Pterodactyl\Models\User::class, - - /* - |-------------------------------------------------------------------------- - | Authentication Table - |-------------------------------------------------------------------------- - | - | When using the "Database" authentication driver, we need to know which - | table should be used to retrieve your users. We have chosen a basic - | default value but you may easily change it to any table you like. - | - */ - - 'table' => 'users', - - /* - |-------------------------------------------------------------------------- - | Password Reset Settings + | Resetting Passwords |-------------------------------------------------------------------------- | | Here you may set the options for resetting passwords including the view - | that is your password reset e-mail. You can also set the name of the + | that is your password reset e-mail. You may also set the name of the | table that maintains all of the reset tokens for your application. | + | You may specify multiple password reset configurations if you have more + | than one user table or model in the application and you want to have + | separate password reset settings based on the specific user types. + | | The expire time is the number of minutes that the reset token should be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | */ - 'password' => [ - 'email' => 'emails.password', - 'table' => 'password_resets', - 'expire' => 60, + 'passwords' => [ + 'users' => [ + 'provider' => 'users', + 'email' => 'emails.password', + 'table' => 'password_resets', + 'expire' => 60, + ], ], ];