2017-12-17 02:01:21 +08:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Handle the authentication for the API layer
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
2019-11-27 22:19:20 +08:00
|
|
|
use App\Contracts\Middleware;
|
2017-12-17 02:01:21 +08:00
|
|
|
use Closure;
|
2017-12-18 06:58:53 +08:00
|
|
|
use Illuminate\Http\Request;
|
2017-12-17 02:01:21 +08:00
|
|
|
|
2019-11-27 22:19:20 +08:00
|
|
|
/**
|
|
|
|
* Check the app.key to see whether we're installed or not
|
|
|
|
*
|
|
|
|
* If the default key is set and we're not in any of the installer routes
|
|
|
|
* show the message that we need to be installed
|
|
|
|
*/
|
|
|
|
class InstalledCheck implements Middleware
|
2017-12-17 02:01:21 +08:00
|
|
|
{
|
2017-12-18 06:58:53 +08:00
|
|
|
public function handle(Request $request, Closure $next)
|
2017-12-17 02:01:21 +08:00
|
|
|
{
|
2017-12-18 06:58:53 +08:00
|
|
|
if (config('app.key') === 'base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY='
|
|
|
|
&& !$request->is(['install', 'install/*'])
|
|
|
|
&& !$request->is(['update', 'update/*'])
|
|
|
|
) {
|
2020-03-03 04:58:53 +08:00
|
|
|
return response(view('system.errors.not_installed'));
|
2017-12-17 02:01:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|