mirror of
https://github.com/pyrohost/pyrodactyl.git
synced 2026-04-06 04:01:58 +02:00
- Remove ReCaptcha support and all related files
- Adds support for the following captchas
- Cloudflare Turnstile
- Hcaptcha
- Friendly Captcha
- Implement new captcha middleware and controller
- Add frontend components for new captcha options
- Update settings configuration and views
Closes #169
54 lines
1.6 KiB
PHP
54 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Pterodactyl\Http\Controllers\Admin\Settings;
|
|
|
|
use Illuminate\View\View;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Prologue\Alerts\AlertsMessageBag;
|
|
use Illuminate\Contracts\Console\Kernel;
|
|
use Illuminate\View\Factory as ViewFactory;
|
|
use Pterodactyl\Http\Controllers\Controller;
|
|
use Illuminate\Contracts\Config\Repository as ConfigRepository;
|
|
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;
|
|
use Pterodactyl\Http\Requests\Admin\Settings\AdvancedSettingsFormRequest;
|
|
|
|
class AdvancedController extends Controller
|
|
{
|
|
/**
|
|
* AdvancedController constructor.
|
|
*/
|
|
public function __construct(
|
|
private AlertsMessageBag $alert,
|
|
private ConfigRepository $config,
|
|
private Kernel $kernel,
|
|
private SettingsRepositoryInterface $settings,
|
|
private ViewFactory $view,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* Render advanced Panel settings UI.
|
|
*/
|
|
public function index(): View
|
|
{
|
|
return $this->view->make('admin.settings.advanced');
|
|
}
|
|
|
|
/**
|
|
* Update advanced settings.
|
|
*
|
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
|
*/
|
|
public function update(AdvancedSettingsFormRequest $request): RedirectResponse
|
|
{
|
|
foreach ($request->normalize() as $key => $value) {
|
|
$this->settings->set('settings::' . $key, $value);
|
|
}
|
|
|
|
$this->kernel->call('queue:restart');
|
|
$this->alert->success('Advanced settings have been updated successfully and the queue worker was restarted to apply these changes.')->flash();
|
|
|
|
return redirect()->route('admin.settings.advanced');
|
|
}
|
|
} |