mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2025-10-07 00:11:27 -04:00
[Dovecot] Fix EAS login and improve logging
This commit is contained in:
parent
766c5e8580
commit
c4d0f35008
@ -80,7 +80,7 @@ if ($isSOGoRequest) {
|
|||||||
}
|
}
|
||||||
if ($result === false){
|
if ($result === false){
|
||||||
// If it's a SOGo Request, don't check for protocol access
|
// If it's a SOGo Request, don't check for protocol access
|
||||||
$service = (isSOGoRequest) ? false : array($post['service'] => true);
|
$service = ($isSOGoRequest) ? false : array($post['service'] => true);
|
||||||
$result = apppass_login($post['username'], $post['password'], $service, array(
|
$result = apppass_login($post['username'], $post['password'], $service, array(
|
||||||
'is_internal' => true,
|
'is_internal' => true,
|
||||||
'remote_addr' => $post['real_rip']
|
'remote_addr' => $post['real_rip']
|
||||||
|
@ -34,8 +34,15 @@ function auth_password_verify(request, password)
|
|||||||
return dovecot.auth.PASSDB_RESULT_INTERNAL_FAILURE, "Upstream error"
|
return dovecot.auth.PASSDB_RESULT_INTERNAL_FAILURE, "Upstream error"
|
||||||
end
|
end
|
||||||
|
|
||||||
local api_response = json.decode(table.concat(res))
|
local response_str = table.concat(res)
|
||||||
if api_response.success == true then
|
local is_response_valid, response_json = pcall(json.decode, response_str)
|
||||||
|
|
||||||
|
if not is_response_valid then
|
||||||
|
dovecot.i_info("Invalid JSON received: " .. response_str)
|
||||||
|
return dovecot.auth.PASSDB_RESULT_INTERNAL_FAILURE, "Invalid response format"
|
||||||
|
end
|
||||||
|
|
||||||
|
if response_json.success == true then
|
||||||
return dovecot.auth.PASSDB_RESULT_OK, ""
|
return dovecot.auth.PASSDB_RESULT_OK, ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user