added auth scaffolding

This commit is contained in:
2018-07-08 21:36:14 +02:00
parent c941599f01
commit d1fa087121
11 changed files with 58213 additions and 0 deletions
+15
View File
@@ -3,6 +3,7 @@
namespace App\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
@@ -48,4 +49,18 @@ class Handler extends ExceptionHandler
{
return parent::render($request, $exception);
}
/**
* Redirect to the login field on failed auth
*
* @param \Illuminate\Http\Request $request
* @param AuthenticationException $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
{
return $request->expectsJson()
? response()->json(['message' => $exception->getMessage()], 401)
: redirect()->guest(route('login'));
}
}