mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-29 02:20:07 +01:00
30 lines
649 B
PHP
30 lines
649 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Response;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class RejectIfDemoMode
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @return mixed
|
|
*/
|
|
public function handle($request, Closure $next)
|
|
{
|
|
|
|
if( config('2fauth.config.isDemoApp') ) {
|
|
Log::notice('Cannot request this action in Demo mode');
|
|
|
|
return response()->json(['message' => __('auth.forms.disabled_in_demo')], Response::HTTP_UNAUTHORIZED);
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|