Bug 1593611 - For accounts with OAuth2 authentication, make passwordPromptRequired false since the normal password won't be used. r=mkmelin
authorGene Smith <gds@chartertn.net>
Wed, 19 Feb 2020 12:35:39 +0200
changeset 37380 7a6415f8b8cdcf494368f2b87de8bf549ef915c3
parent 37379 e80f11af397574ab1816d0f6982530164d855ce6
child 37381 1c9f4fdf777217c65e8760abbc9d5ef6215927b9
push id2566
push userclokep@gmail.com
push dateMon, 09 Mar 2020 19:20:31 +0000
treeherdercomm-beta@a352facfa0a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1593611
Bug 1593611 - For accounts with OAuth2 authentication, make passwordPromptRequired false since the normal password won't be used. r=mkmelin 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;