mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-08 03:54:20 +01:00
Refactor.
- merge validation into one block.
This commit is contained in:
parent
742a0d73c2
commit
12e58b1dd0
@ -109,7 +109,13 @@ $sync->addField('otp', $syncParams['otp']);
|
|||||||
# Verify correctness of input parameters
|
# Verify correctness of input parameters
|
||||||
#
|
#
|
||||||
|
|
||||||
foreach (array('modified') as $param) {
|
foreach (array('modified','yk_counter', 'yk_use', 'yk_high', 'yk_low') as $param)
|
||||||
|
{
|
||||||
|
// -1 is valid except for modified
|
||||||
|
if ($param !== 'modified' && $syncParams[$param] === '-1')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// [0-9]+
|
||||||
if ($syncParams[$param] !== '' && ctype_digit($syncParams[$param]))
|
if ($syncParams[$param] !== '' && ctype_digit($syncParams[$param]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -117,19 +123,6 @@ foreach (array('modified') as $param) {
|
|||||||
sendResp(S_MISSING_PARAMETER, $myLog, $apiKey);
|
sendResp(S_MISSING_PARAMETER, $myLog, $apiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (array('yk_counter', 'yk_use', 'yk_high', 'yk_low') as $param) {
|
|
||||||
if ($syncParams[$param] === '-1')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ($syncParams[$param] !== '' && ctype_digit($syncParams[$param]))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
$myLog->log(LOG_NOTICE, 'Input parameters ' . $param . ' not correct');
|
|
||||||
sendResp(S_MISSING_PARAMETER, $myLog, $apiKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Get local counter data
|
# Get local counter data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user