mirror of
https://github.com/projectsend/projectsend.git
synced 2026-09-16 16:45:07 +00:00
6e47d76ba6
Client file sharing, rebuilt from the ground up: a private area per client, resumable uploads, folders, groups and categories, sharing with expiry dates and download limits, comments, file versions, an activity log, a REST API, and sixteen languages. This repository begins here. ProjectSend 2 was developed privately, and that development history is not published — the previous generation remains available, with its own history, at projectsend/legacy. Free software under the GNU General Public License v2, or (at your option) any later version.
54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Modules\Platform\Captcha\Console;
|
||
|
||
use App\Modules\Platform\Captcha\Captcha;
|
||
use App\Modules\Platform\Captcha\CaptchaVerifier;
|
||
use Illuminate\Console\Command;
|
||
|
||
/**
|
||
* Check the configured secret key against the provider.
|
||
*
|
||
* The same probe the settings screen's Test keys button runs, for anyone
|
||
* diagnosing an installation over SSH — and, more usefully, for a
|
||
* deployment script that wants to know its keys survived the move before
|
||
* the first visitor finds out they did not.
|
||
*/
|
||
class TestCaptchaCommand extends Command
|
||
{
|
||
protected $signature = 'projectsend:captcha-test';
|
||
|
||
protected $description = 'Check the configured CAPTCHA keys against the provider';
|
||
|
||
public function handle(Captcha $captcha, CaptchaVerifier $verifier): int
|
||
{
|
||
$active = $captcha->active();
|
||
|
||
if ($active === null) {
|
||
$this->warn('No CAPTCHA is configured, so there is nothing to test.');
|
||
|
||
return self::SUCCESS;
|
||
}
|
||
|
||
$this->line(sprintf(
|
||
'Testing %s with %s keys…',
|
||
$active->provider->label(),
|
||
$active->managed ? 'the platform’s' : 'this installation’s',
|
||
));
|
||
|
||
$result = $verifier->test($active->provider, $active->secretKey);
|
||
|
||
if ($result['ok']) {
|
||
$this->info($result['message']);
|
||
|
||
return self::SUCCESS;
|
||
}
|
||
|
||
$this->error($result['message']);
|
||
|
||
return self::FAILURE;
|
||
}
|
||
}
|