Add red banner if app is in production mode and debugging is turned on

This commit is contained in:
snipe 2016-11-29 00:08:20 -08:00
parent 4c08331c9d
commit ba23952852
4 changed files with 39 additions and 0 deletions

View file

@ -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,
];
/**

View 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);
}
}

View file

@ -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',

View file

@ -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">