Miguel N
8942623bde
This commit moves most controller logic onto Services. Services are part of the Service-Repository pattern. The models act as repositories. Services are easily testable and are needed for the upcoming API, in order to avoid duplicated code and to maintain a single source of "truth". The User, Vacancy and Vote controllers still need their logic moved onto services.
36 lines
907 B
PHP
36 lines
907 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Facades\Options;
|
|
use App\Http\Requests\SaveSecuritySettings;
|
|
use App\Services\SecuritySettingsService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
use function PHPSTORM_META\map;
|
|
|
|
class SecuritySettingsController extends Controller
|
|
{
|
|
private $securityService;
|
|
|
|
public function __construct(SecuritySettingsService $securityService) {
|
|
$this->securityService = $securityService;
|
|
}
|
|
|
|
public function save(SaveSecuritySettings $request)
|
|
{
|
|
$this->securityService->save($request->secPolicy, [
|
|
'graceperiod' => $request->graceperiod,
|
|
'pwExpiry' => $request->pwExpiry,
|
|
'enforce2fa' => $request->enforce2fa,
|
|
'requirePMC' => $request->requirePMC
|
|
]);
|
|
|
|
return redirect()
|
|
->back()
|
|
->with('success', __('Settings saved.'));
|
|
|
|
}
|
|
}
|