Bug 1593611 - For accounts with OAuth2 authentication, make passwordPromptRequired false since the normal password won't be used. r=mkmelin a=wsmwk
authorGene Smith <gds@chartertn.net>
Wed, 19 Feb 2020 12:35:39 +0200
changeset 37297 19caa7e2f99524c46b8a93ae142bdeeee2f7fe90
parent 37296 f08f6af8f30b20fc5978e2343aa32295aaa141b4
child 37298 f6cd636ceb740dde5d108647c5a68da77725a710
push id2559
push userthunderbird@calypsoblue.org
push dateFri, 21 Feb 2020 22:57:54 +0000
treeherdercomm-beta@8c986f1b128d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, wsmwk
bugs1593611
Bug 1593611 - For accounts with OAuth2 authentication, make passwordPromptRequired false since the normal password won't be used. r=mkmelin a=wsmwk Having passwordPromptRequired true for accounts with OAuth2 authentication prevented them from being checked on "Get All New Messages" which do not include accounts which would need to ask for password in the process (and cause many prompts in the process).
mailnews/base/util/nsMsgIncomingServer.cpp
--- a/mailnews/base/util/nsMsgIncomingServer.cpp
+++ b/mailnews/base/util/nsMsgIncomingServer.cpp
@@ -1638,16 +1638,24 @@ nsMsgIncomingServer::GetPasswordPromptRe
   nsresult rv = GetServerRequiresPasswordForBiff(aPasswordIsRequired);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!*aPasswordIsRequired) return NS_OK;
 
   // If the password is empty, check to see if it is stored and to be retrieved
   if (m_password.IsEmpty()) (void)GetPasswordWithoutUI();
 
   *aPasswordIsRequired = m_password.IsEmpty();
+  if (*aPasswordIsRequired) {
+    // Set *aPasswordIsRequired false if authMethod is oauth2.
+    int32_t authMethod = 0;
+    rv = GetAuthMethod(&authMethod);
+    if (NS_SUCCEEDED(rv) && authMethod == nsMsgAuthMethod::OAuth2) {
+      *aPasswordIsRequired = false;
+    }
+  }
   return rv;
 }
 
 NS_IMETHODIMP nsMsgIncomingServer::ConfigureTemporaryFilters(
     nsIMsgFilterList *aFilterList) {
   nsresult rv = ConfigureTemporaryReturnReceiptsFilter(aFilterList);
   if (NS_FAILED(rv))  // shut up warnings...
     return rv;