From 77cf15cf5e58897135b3300dfcaf0d4eef560ace Mon Sep 17 00:00:00 2001 From: Bubka <858858+Bubka@users.noreply.github.com> Date: Fri, 1 Oct 2021 13:34:28 +0200 Subject: [PATCH] Move isDemoApp to a new 2FAuth config file --- app/Console/Commands/ResetDemo.php | 2 +- app/Http/Middleware/AvoidPasswordResetInDemo.php | 2 +- config/2fauth.php | 9 +++++++++ config/app.php | 1 - 4 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 config/2fauth.php diff --git a/app/Console/Commands/ResetDemo.php b/app/Console/Commands/ResetDemo.php index 693438d1..54e66e2e 100644 --- a/app/Console/Commands/ResetDemo.php +++ b/app/Console/Commands/ResetDemo.php @@ -39,7 +39,7 @@ public function __construct() */ public function handle() { - if( !config('app.options.isDemoApp') ) { + if( !config('2fauth.config.isDemoApp') ) { $this->comment('2fauth:reset-demo can only run when isDemoApp option is On'); return; } diff --git a/app/Http/Middleware/AvoidPasswordResetInDemo.php b/app/Http/Middleware/AvoidPasswordResetInDemo.php index 10b67218..326dd114 100644 --- a/app/Http/Middleware/AvoidPasswordResetInDemo.php +++ b/app/Http/Middleware/AvoidPasswordResetInDemo.php @@ -17,7 +17,7 @@ class AvoidPasswordResetInDemo public function handle($request, Closure $next) { - if( config('app.options.isDemoApp') ) { + if( config('2fauth.config.isDemoApp') ) { return response()->json(['requestFailed' => __('auth.forms.no_reset_password_in_demo')], Response::HTTP_UNAUTHORIZED); } diff --git a/config/2fauth.php b/config/2fauth.php new file mode 100644 index 00000000..51db3418 --- /dev/null +++ b/config/2fauth.php @@ -0,0 +1,9 @@ + [ + 'isDemoApp' => env('IS_DEMO_APP', false), + ], + +]; \ No newline at end of file diff --git a/config/app.php b/config/app.php index aba7a97b..1fad4fe8 100644 --- a/config/app.php +++ b/config/app.php @@ -32,7 +32,6 @@ */ 'options' => [ - 'isDemoApp' => env('IS_DEMO_APP', false), 'showTokenAsDot' => false, 'closeTokenOnCopy' => false, 'useBasicQrcodeReader' => false,