Bugfix: undefined SASLMechanisms

This commit is contained in:
the-djmaze 2022-10-11 08:22:16 +02:00
parent b3476818ee
commit 4583616ea6

View file

@ -285,9 +285,22 @@ class ActionsAdmin extends Actions
$sUsername = $this->GetActionParam('username', '');
if ($sUsername) {
$aSASLMechanisms = [];
$oConfig = $this->Config();
if ($oConfig->Get('labs', 'sasl_allow_scram_sha', false)) {
// https://github.com/the-djmaze/snappymail/issues/182
\array_push($aSASLMechanisms, 'SCRAM-SHA3-512', 'SCRAM-SHA-512', 'SCRAM-SHA-256', 'SCRAM-SHA-1');
}
if ($oConfig->Get('labs', 'sasl_allow_cram_md5', false)) {
$aSASLMechanisms[] = 'CRAM-MD5';
}
if ($oConfig->Get('labs', 'sasl_allow_plain', true)) {
$aSASLMechanisms[] = 'PLAIN';
}
$oImapClient->Login([
'Login' => $sUsername,
'Password' => $this->GetActionParam('password', '')
'Password' => $this->GetActionParam('password', ''),
'SASLMechanisms' => $aSASLMechanisms
]);
}