]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Adds some logging so we know which login method has failed
authorTrenton Holmes <trenton.holmes@psware.com>
Wed, 13 Apr 2022 20:57:39 +0000 (13:57 -0700)
committerTrenton Holmes <trenton.holmes@psware.com>
Tue, 26 Apr 2022 16:41:36 +0000 (09:41 -0700)
src/paperless_mail/mail.py
src/paperless_mail/tests/test_mail.py

index 4f41126cfa6f8ca0be807e33716097e9fe4ae36a..2b3267aeb36a41330962898b4f84ba01af720ee1 100644 (file)
@@ -167,6 +167,7 @@ class MailAccountHandler(LoggingMixin):
                 M.login(account.username, account.password)
 
             except UnicodeEncodeError:
+                self.log("debug", "Falling back to AUTH=PLAIN")
                 try:
                     # rfc2595 section 6 - PLAIN SASL mechanism
                     client: IMAP4 = M.client
@@ -184,8 +185,13 @@ class MailAccountHandler(LoggingMixin):
                     # Need to transition out of AUTH state to SELECTED
                     M.folder.set("INBOX")
                 except Exception:
+                    self.log(
+                        "error",
+                        "Unable to authenticate with mail server using AUTH=PLAIN",
+                    )
                     raise MailError(f"Error while authenticating account {account}")
             except Exception:
+                self.log("error", "Unable to authenticate with mail server")
                 raise MailError(f"Error while authenticating account {account}")
 
             self.log(
index 352c3f3696ce15f7f22fe7f73a9fa5ec8e9df8b2..85fda297588fdf0b32121023726b959cf8c89a01 100644 (file)
@@ -869,7 +869,7 @@ class TestMail(DirectoriesMixin, TestCase):
         """
         GIVEN:
             - Mail account with password containing non-ASCII characters
-            - Incorrect password alue
+            - Incorrect password value
         THEN:
             - Should raise a MailError for the account
         """