sftpgo-auth.php 619 B

123456789101112131415161718192021222324
  1. <?php
  2. require 'router.php';
  3. $authData = json_decode(file_get_contents('php://input'), true);
  4. if (userExist($authData['username']) === true AND checkPassword($authData['username'], $authData['password']) === true) {
  5. $quotaSize = (query('select', 'users', ['username' => $authData['username']], 'type')[0] === 'trusted') ? CONF['ht']['user_quota_trusted'] : CONF['ht']['user_quota_testing'];
  6. echo '
  7. {
  8. "status": 1,
  9. "username": "' . $authData['username'] . '",
  10. "quota_size": ' . $quotaSize . ',
  11. "permissions": {
  12. "/": [
  13. "*"
  14. ]
  15. }
  16. }
  17. ';
  18. http_response_code(200);
  19. } else {
  20. http_response_code(403);
  21. }