mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 22:07:29 -08:00
Add red banner if app is in production mode and debugging is turned on
This commit is contained in:
parent
4c08331c9d
commit
ba23952852
|
@ -23,6 +23,7 @@ class Kernel extends HttpKernel
|
|||
\App\Http\Middleware\CheckForSetup::class,
|
||||
\Fideloper\Proxy\TrustProxies::class,
|
||||
\App\Http\Middleware\GetAppSettings::class,
|
||||
\App\Http\Middleware\CheckForDebug::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
27
app/Http/Middleware/CheckForDebug.php
Normal file
27
app/Http/Middleware/CheckForDebug.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Auth;
|
||||
|
||||
class CheckForDebug
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (((Auth::check() && (Auth::user()->isSuperUser()))) && (app()->environment()=='production') && (config('app.debug')===true)) {
|
||||
view()->share('debug_in_production', true);
|
||||
} else {
|
||||
view()->share('debug_in_production', false);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -49,6 +49,8 @@
|
|||
'custom_report' => 'Custom Asset Report',
|
||||
'dashboard' => 'Dashboard',
|
||||
'date' => 'Date',
|
||||
'debug_warning' => 'Warning!',
|
||||
'debug_warning_text' => 'This application is running in production mode with debugging enabled. This can expose sensitive data if your application is accessible to the outside world. Disable debug mode by setting the <code>APP_DEBUG</code> value in your <code>.env</code> file to <code>false</code>.',
|
||||
'delete' => 'Delete',
|
||||
'deleted' => 'Deleted',
|
||||
'delete_seats' => 'Deleted Seats',
|
||||
|
|
|
@ -529,6 +529,15 @@
|
|||
|
||||
<div class="content-wrapper">
|
||||
|
||||
@if ($debug_in_production)
|
||||
<div class="row" style="margin-bottom: 0px; background-color: red; color: white; font-size: 15px;">
|
||||
<div class="col-md-12" style="margin-bottom: 0px; background-color: red; color: white; padding: 10px 20px 10px 30px; font-size: 16px;">
|
||||
<i class="fa fa-warning fa-3x pull-left"></i> <strong>{{ strtoupper(trans('general.debug_warning')) }}:</strong>
|
||||
{!! trans('general.debug_warning_text') !!}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header" style="padding-bottom: 30px;">
|
||||
<h1 class="pull-left">
|
||||
|
|
Loading…
Reference in a new issue