ported from mozilla: Bug 1538409 - implement oAuth authentication for POP accounts r=benc a=mkmelin (f6219b04be)

This commit is contained in:
roytam1 2024-09-21 18:23:52 +08:00
commit 08feac8e97
6 changed files with 212 additions and 35 deletions

View file

@ -5,6 +5,9 @@
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource:///modules/mailServices.js");
#ifdef MOZ_MAILNEWS_OAUTH2
Components.utils.import("resource:///modules/OAuth2Providers.js");
#endif
var gSmtpServerListWindow =
{
@ -155,9 +158,19 @@ var gSmtpServerListWindow =
Components.utils.reportError("Warning: unknown value for smtpserver... authMethod: " +
aServer.authMethod);
}
if (authStr)
if (authStr) {
#ifdef MOZ_MAILNEWS_OAUTH2
let details = OAuth2Providers.getHostnameDetails(aServer.hostname);
if (!details) {
document
.getElementById("authMethod-oauth2")
.toggleAttribute("disabled", true);
}
#endif
document.getElementById("authMethodValue").value =
this.mBundle.getString(authStr);
}
},
refreshServerList: function(aServerKeyToSelect, aFocusList)