Skip to content

Commit

Permalink
Merge 983fbaf into 327f93e
Browse files Browse the repository at this point in the history
  • Loading branch information
shepver authored Jul 25, 2022
2 parents 327f93e + 983fbaf commit 308786f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"require": {
"php": "^7.1||^8.0",
"psr/http-client": "^1.0",
"psr/cache": "^1.0",
"psr/cache": "^1.0|^2.0|^3.0",
"psr/http-message": "^1.0",
"psr/http-message-implementation": "^1.0",
"psr/http-factory-implementation": "^1.0",
Expand Down
8 changes: 7 additions & 1 deletion src/AbstractPasswordExposedChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +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) {
return PasswordStatus::EXPOSED;
}

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

0 comments on commit 308786f

Please sign in to comment.