mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-26 02:17:34 +09:00
ported from mozilla: Bug 1538409 - implement oAuth authentication for POP accounts r=benc a=mkmelin (f6219b04be)
This commit is contained in:
parent
2dfde2a62e
commit
08feac8e97
6 changed files with 212 additions and 35 deletions
|
|
@ -30,10 +30,12 @@ function onInit(aPageId, aServerId)
|
|||
if (serverType == "imap")
|
||||
setupImapDeleteUI(aServerId);
|
||||
|
||||
// TLS Cert (External) and OAuth2 are only supported on IMAP.
|
||||
#ifdef MOZ_MAILNEWS_OAUTH2
|
||||
document.getElementById("authMethod-oauth2").hidden = (serverType != "imap");
|
||||
// OAuth2 are only supported on IMAP and POP.
|
||||
document.getElementById("authMethod-oauth2").hidden =
|
||||
serverType != "imap" && serverType != "pop3";
|
||||
#endif
|
||||
// TLS Cert (External) and OAuth2 are only supported on IMAP.
|
||||
document.getElementById("authMethod-external").hidden = (serverType != "imap");
|
||||
|
||||
// "STARTTLS, if available" is vulnerable to MITM attacks so we shouldn't
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue