servnest/sftpgo-auth.php

25 lines
619 B
PHP
Raw Normal View History

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