mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Merge pull request #5158 from pixelfed/staging
Add app:captcha-toggle-command command to disable captcha from cli
This commit is contained in:
commit
9bd7f86605
1 changed files with 52 additions and 0 deletions
52
app/Console/Commands/CaptchaToggleCommand.php
Normal file
52
app/Console/Commands/CaptchaToggleCommand.php
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use function Laravel\Prompts\info;
|
||||
use function Laravel\Prompts\confirm;
|
||||
use App\Services\ConfigCacheService;
|
||||
|
||||
class CaptchaToggleCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:captcha-toggle-command';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$captchaEnabled = (bool) config_cache('captcha.enabled');
|
||||
|
||||
info($captchaEnabled ? 'Captcha is enabled' : 'Captcha is not enabled');
|
||||
|
||||
if(!$captchaEnabled) {
|
||||
info('Enable the Captcha from the admin settings dashboard.');
|
||||
return;
|
||||
}
|
||||
|
||||
$confirmed = confirm(
|
||||
label: 'Do you want to disable the captcha?',
|
||||
default: false,
|
||||
yes: 'Yes',
|
||||
no: 'No',
|
||||
hint: 'Select an option to proceed.'
|
||||
);
|
||||
|
||||
if($confirmed) {
|
||||
ConfigCacheService::put('captcha.enabled', false);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue