Skip to content

Commit

Permalink
fix getPasswordStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Gugnin authored and Mikhail Gugnin committed Jul 25, 2022
1 parent 8e7cece commit 983fbaf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/AbstractPasswordExposedChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,15 @@ protected function getPasswordStatus($hash, $responseBody): string
$hash = strtoupper($hash);
$hashSuffix = substr($hash, 5);

$lines = explode("\r\n", $responseBody);
// If api return last row record with "\r\n"
$lines = array_filter(explode("\r\n", $responseBody));

foreach ($lines as $line) {
// If api return error text
if (strpos($line,':') === false) {
continue;
return PasswordStatus::EXPOSED;
}

list($exposedHashSuffix, $occurrences) = explode(':', $line);
if (hash_equals($hashSuffix, $exposedHashSuffix)) {
return PasswordStatus::EXPOSED;
Expand Down

0 comments on commit 983fbaf

Please sign in to comment.