1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2025-12-13 09:56:01 +00:00

[Web] organize auth functions+api auth w/ dovecot

This commit is contained in:
FreddleSpl0it
2023-03-12 19:06:03 +01:00
committed by DerLinkman
parent 50d4d59626
commit 6adad79e5c
11 changed files with 400 additions and 294 deletions

View File

@@ -401,6 +401,26 @@ if (isset($_GET['query'])) {
);
echo json_encode($return);
break;
case "login":
header('Content-Type: application/json');
$post = trim(file_get_contents('php://input'));
if ($post) {
$post = json_decode($post, true);
}
$return = array("success" => false, "role" => false);
if(!isset($post['username']) || !isset($post['password'])){
echo json_encode($return);
return;
}
$result = check_login($post['username'], $post['password'], $post['protocol']);
if ($result) {
$return = array("success" => true, "role" => $result);
}
echo json_encode($return);
return;
break;
}
break;
case "get":