-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check at least one server response #6
Comments
Wouldn't that be correct? If it fails on |
The code above is a suggestion how to change it. The current function sets public function success($first = false)
{
$success = true;
if ($first === true) {
// Sort them by timestamp, pop the first one and return pass/fail
usort($this->responses, function($r1, $r2) {
return $r1->getMt() > $r2->getMt();
});
$response = $this->responses[0];
return $response->success();
} else {
foreach ($this->responses as $response) {
if ($response->success() === false) {
return false;
}
}
}
return $success;
} Here an example with the current function. $v = new \Yubikey\Validate($apiKey, $clientId, array("localhost:8888"));
$result = $v->check($otp);
print_r($result);
var_export($result->success()); You get the following output:
|
Thanks for the suggestion - I've added it in 7a78243 |
If the connection to the server fails the responses array in the
ResponseCollection class is empty and the success function returns true.
Perhaps the default value of $success should be false and set to true if
at least one response was successful.
The text was updated successfully, but these errors were encountered: