1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2025-07-15 01:34:16 +02:00

[Web] add curl timeouts to oidc requests

This commit is contained in:
FreddleSpl0it
2023-07-07 08:52:54 +02:00
committed by DerLinkman
parent 8ce4600562
commit 6df663825a
2 changed files with 19 additions and 4 deletions

View File

@ -299,6 +299,7 @@ function keycloak_mbox_login_rest($user, $pass, $iam_settings, $is_internal = fa
$queryParams = array('email' => $user, 'exact' => true);
$queryString = http_build_query($queryParams);
$curl = curl_init();
curl_setopt($curl, CURLOPT_TIMEOUT, 7);
curl_setopt($curl, CURLOPT_URL, $url . '?' . $queryString);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
@ -311,6 +312,12 @@ function keycloak_mbox_login_rest($user, $pass, $iam_settings, $is_internal = fa
if ($code != 200) {
return false;
}
if (!isset($user_res['attributes']['mailcow_password']) || !is_array($user_res['attributes']['mailcow_password'])){
return false;
}
if (empty($user_res['attributes']['mailcow_password'][0])){
return false;
}
// validate mailcow_password
$mailcow_password = $user_res['attributes']['mailcow_password'][0];