diff --git a/app/Http/Controllers/OptionsController.php b/app/Http/Controllers/OptionsController.php index 2bba992..2ffb67b 100755 --- a/app/Http/Controllers/OptionsController.php +++ b/app/Http/Controllers/OptionsController.php @@ -40,7 +40,14 @@ class OptionsController extends Controller $options = Option::all(); return view('dashboard.administration.settings') - ->with('options', $options); + ->with('options', $options) + ->with('security', [ + 'secPolicy' => Options::getOption('pw_security_policy'), + 'graceperiod' => Options::getOption('graceperiod'), + 'pwExpiry' => Options::getOption('password_expiry'), + 'requiresPMC' => Options::getOption('requireGameLicense'), + 'enforce2fa' => Options::getOption('force2fa') + ]); } public function saveSettings(Request $request) diff --git a/app/Http/Controllers/SecuritySettingsController.php b/app/Http/Controllers/SecuritySettingsController.php new file mode 100644 index 0000000..14b214d --- /dev/null +++ b/app/Http/Controllers/SecuritySettingsController.php @@ -0,0 +1,48 @@ +secPolicy, $validPolicies)) + { + Options::changeOption('pw_security_policy', $request->secPolicy); + + Log::debug('[Options] Changing option pw_security_policy', [ + 'new_value' => $request->secPolicy + ]); + } + else + { + Log::debug('[WARN] Ignoring bogus policy', [ + 'avaliable' => $validPolicies, + 'given' >= $request->secPolicy + ]); + } + + Options::changeOption('graceperiod', $request->graceperiod); + Options::changeOption('password_expiry', $request->pwExpiry); + Options::changeOption('force2fa', $request->enforce2fa); + Options::changeOption('requireGameLicense', $request->requirePMC); + + $request->session()->flash('success', 'Settings saved successfully.'); + return redirect()->back(); + + } +} diff --git a/app/Http/Requests/SaveSecuritySettings.php b/app/Http/Requests/SaveSecuritySettings.php new file mode 100644 index 0000000..245d630 --- /dev/null +++ b/app/Http/Requests/SaveSecuritySettings.php @@ -0,0 +1,34 @@ + 'required|string', + 'graceperiod' => 'required|integer', + 'pwExpiry' => 'required|integer', + 'enforce2fa' => 'required|boolean', + 'requirePMC' => 'required|boolean' + ]; + } +} diff --git a/resources/views/dashboard/administration/settings.blade.php b/resources/views/dashboard/administration/settings.blade.php index 0fe0d73..5c5f39b 100755 --- a/resources/views/dashboard/administration/settings.blade.php +++ b/resources/views/dashboard/administration/settings.blade.php @@ -138,7 +138,7 @@