servnest/sftpgo-auth.php

25 lines
619 B
PHP
Raw Normal View History

2022-05-19 14:59:32 +00:00
<?php
require "router.php";
2022-05-19 14:59:32 +00:00
$authData = json_decode(file_get_contents("php://input"), true);
if (userExist($authData['username']) === true AND checkPassword($authData['username'], $authData['password']) === true) {
2022-11-07 18:40:40 +00:00
$quotaSize = (query('select', 'users', ['username' => $authData['username']], 'type')[0] === 'trusted') ? CONF['ht']['user_quota_trusted'] : CONF['ht']['user_quota_testing'];
2022-06-28 20:08:34 +00:00
echo '
{
"status": 1,
"username": "' . $authData['username'] . '",
2022-11-07 18:40:40 +00:00
"quota_size": ' . $quotaSize . ',
2022-06-28 20:08:34 +00:00
"permissions": {
"/": [
"*"
]
}
}
';
2022-05-19 14:59:32 +00:00
http_response_code(200);
} else {
http_response_code(403);
}