diff --git a/lib/Exception/CouldNotConnectException.php b/lib/Exception/CouldNotConnectException.php index 5cbd92eb32..410135a218 100644 --- a/lib/Exception/CouldNotConnectException.php +++ b/lib/Exception/CouldNotConnectException.php @@ -65,7 +65,11 @@ public function getReason(): string { switch ($this->previous->getCode()) { case Horde_Imap_Client_Exception::LOGIN_AUTHENTICATIONFAILED: - return 'AUTHENTICATION'; + return match ($this->previous->getMessage()) { + 'Authentication failed.' => 'AUTHENTICATION_WRONG_PASSWORD', + 'Mail server denied authentication.' => 'AUTHENTICATION_DENIED', + default => 'AUTHENTICATION', + }; case Horde_Imap_Client_Exception::SERVER_CONNECT: case Horde_Imap_Client_Exception::SERVER_READERROR: return 'CONNECTION_ERROR'; diff --git a/src/components/AccountForm.vue b/src/components/AccountForm.vue index e9d4dd83dd..b2c29594a2 100644 --- a/src/components/AccountForm.vue +++ b/src/components/AccountForm.vue @@ -669,12 +669,24 @@ export default { } else if (error.data.service === 'SMTP') { this.feedback = t('mail', 'SMTP server is not reachable') } - } else if (error.data?.error === 'AUTHENTICATION') { + } else if (error.data?.error === 'AUTHENTICATION_WRONG_PASSWORD') { if (error.data.service === 'IMAP') { this.feedback = t('mail', 'IMAP username or password is wrong') } else if (error.data.service === 'SMTP') { this.feedback = t('mail', 'SMTP username or password is wrong') } + } else if (error.data?.error === 'AUTHENTICATION_DENIED') { + if (error.data.service === 'IMAP') { + this.feedback = t('mail', 'IMAP server denied authentication') + } else if (error.data.service === 'SMTP') { + this.feedback = t('mail', 'SMTP server denied authentication') + } + } else if (error.data?.error === 'AUTHENTICATION') { + if (error.data.service === 'IMAP') { + this.feedback = t('mail', 'IMAP authentication error') + } else if (error.data.service === 'SMTP') { + this.feedback = t('mail', 'SMTP authentication error') + } } else { if (error.data?.service === 'IMAP') { this.feedback = t('mail', 'IMAP connection failed')