mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 00:47:04 +03:00
Bugfix haveibeenpwned suffix handling
This commit is contained in:
parent
c9d3f3de4a
commit
6739ec21c8
1 changed files with 4 additions and 3 deletions
|
|
@ -51,7 +51,9 @@ class HaveibeenpwnedPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
$pass = \sha1($oAccount->ImapPass());
|
$pass = \sha1($oAccount->ImapPass());
|
||||||
$response = $HTTP->doRequest('GET', 'https://api.pwnedpasswords.com/range/' . \substr($pass, 0, 5));
|
$prefix = \substr($pass, 0, 5);
|
||||||
|
$suffix = \substr($pass, 5);
|
||||||
|
$response = $HTTP->doRequest('GET', "https://api.pwnedpasswords.com/range/{$prefix}");
|
||||||
$passwords = [];
|
$passwords = [];
|
||||||
foreach (\preg_split('/\\R/', $response->body) as $entry) {
|
foreach (\preg_split('/\\R/', $response->body) as $entry) {
|
||||||
if ($entry) {
|
if ($entry) {
|
||||||
|
|
@ -61,8 +63,7 @@ class HaveibeenpwnedPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->jsonResponse(__FUNCTION__, array(
|
return $this->jsonResponse(__FUNCTION__, array(
|
||||||
'pwned' => isset($passwords[$pass]) ? $passwords[$pass] : 0,
|
'pwned' => isset($passwords[$suffix]) ? $passwords[$suffix] : 0,
|
||||||
// 'passwords' => $passwords,
|
|
||||||
'breached' => $breached ? [
|
'breached' => $breached ? [
|
||||||
'request_uri' => $breached->request_uri,
|
'request_uri' => $breached->request_uri,
|
||||||
'final_uri' => $breached->final_uri,
|
'final_uri' => $breached->final_uri,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue