Skip to content

Commit 608b9d7

Browse files
author
Stuart H Jimenez
committed
If you use an api key you wont have to set a user name, if you don't use a key you will have to login as admin.
1 parent b7dbf07 commit 608b9d7

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

web/api/index.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
// Authentication
77
$auth_code = 1;
88
if (empty($_POST['hash'])) {
9+
// Check user permission to use API
10+
if ($_POST['user'] != 'admin') {
11+
echo 'Error: only admin is allowed to use API';
12+
exit;
13+
}
14+
915
$v_user = escapeshellarg($_POST['user']);
1016
$v_password = escapeshellarg($_POST['password']);
1117
exec(VESTA_CMD ."v-check-user-password ".$v_user." ".$v_password." '".$_SERVER["REMOTE_ADDR"]."'", $output, $auth_code);
@@ -20,13 +26,6 @@
2026
echo 'Error: authentication failed';
2127
exit;
2228
}
23-
24-
// Check user permission to use API
25-
if ($_POST['user'] != 'admin') {
26-
echo 'Error: only admin is allowed to use API';
27-
exit;
28-
}
29-
3029

3130
// Prepare arguments
3231
if (isset($_POST['cmd'])) $cmd = escapeshellarg($_POST['cmd']);

0 commit comments

Comments
 (0)