mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 13:24:25 -07:00
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.
This commit is contained in:
parent
b7dbf07373
commit
608b9d740a
1 changed files with 6 additions and 7 deletions
|
@ -6,6 +6,12 @@ if (isset($_POST['user']) || isset($_POST['hash'])) {
|
||||||
// Authentication
|
// Authentication
|
||||||
$auth_code = 1;
|
$auth_code = 1;
|
||||||
if (empty($_POST['hash'])) {
|
if (empty($_POST['hash'])) {
|
||||||
|
// Check user permission to use API
|
||||||
|
if ($_POST['user'] != 'admin') {
|
||||||
|
echo 'Error: only admin is allowed to use API';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$v_user = escapeshellarg($_POST['user']);
|
$v_user = escapeshellarg($_POST['user']);
|
||||||
$v_password = escapeshellarg($_POST['password']);
|
$v_password = escapeshellarg($_POST['password']);
|
||||||
exec(VESTA_CMD ."v-check-user-password ".$v_user." ".$v_password." '".$_SERVER["REMOTE_ADDR"]."'", $output, $auth_code);
|
exec(VESTA_CMD ."v-check-user-password ".$v_user." ".$v_password." '".$_SERVER["REMOTE_ADDR"]."'", $output, $auth_code);
|
||||||
|
@ -21,13 +27,6 @@ if (isset($_POST['user']) || isset($_POST['hash'])) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check user permission to use API
|
|
||||||
if ($_POST['user'] != 'admin') {
|
|
||||||
echo 'Error: only admin is allowed to use API';
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Prepare arguments
|
// Prepare arguments
|
||||||
if (isset($_POST['cmd'])) $cmd = escapeshellarg($_POST['cmd']);
|
if (isset($_POST['cmd'])) $cmd = escapeshellarg($_POST['cmd']);
|
||||||
if (isset($_POST['arg1'])) $arg1 = escapeshellarg($_POST['arg1']);
|
if (isset($_POST['arg1'])) $arg1 = escapeshellarg($_POST['arg1']);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue