mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 06:31:22 +00:00
Various code cleanup.
This commit is contained in:
@@ -22,9 +22,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\Password;
|
||||
|
||||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Log;
|
||||
use RuntimeException;
|
||||
|
||||
@@ -51,7 +51,7 @@ class PwndVerifierV2 implements Verifier
|
||||
$uri = sprintf('https://api.pwnedpasswords.com/range/%s', $prefix);
|
||||
$opt = [
|
||||
'headers' => [
|
||||
'User-Agent' => 'Firefly III v' . config('firefly.version'),
|
||||
'User-Agent' => sprintf('Firefly III v%s', config('firefly.version')),
|
||||
'Add-Padding' => 'true',
|
||||
],
|
||||
'timeout' => 3.1415];
|
||||
@@ -62,7 +62,7 @@ class PwndVerifierV2 implements Verifier
|
||||
try {
|
||||
$client = new Client();
|
||||
$res = $client->request('GET', $uri, $opt);
|
||||
} catch (GuzzleException | Exception $e) {
|
||||
} catch (GuzzleException | RequestException $e) {
|
||||
Log::error(sprintf('Could not verify password security: %s', $e->getMessage()));
|
||||
|
||||
return true;
|
||||
@@ -73,7 +73,7 @@ class PwndVerifierV2 implements Verifier
|
||||
}
|
||||
try {
|
||||
$strpos = stripos($res->getBody()->getContents(), $rest);
|
||||
} catch (RuntimeException $e) {
|
||||
} catch (RuntimeException $e) { // @phpstan-ignore-line
|
||||
Log::error(sprintf('Could not get body from Pwnd result: %s', $e->getMessage()));
|
||||
$strpos = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user