mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-24 09:27:31 +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)
|
||||
|
|
|
|||
|
|
@ -13,16 +13,20 @@ var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
|
|||
var kHostnames = new Map([
|
||||
["imap.googlemail.com", ["accounts.google.com", "https://mail.google.com/"]],
|
||||
["smtp.googlemail.com", ["accounts.google.com", "https://mail.google.com/"]],
|
||||
["pop.googlemail.com", ["accounts.google.com", "https://mail.google.com/"]],
|
||||
["imap.gmail.com", ["accounts.google.com", "https://mail.google.com/"]],
|
||||
["smtp.gmail.com", ["accounts.google.com", "https://mail.google.com/"]],
|
||||
["pop.gmail.com", ["accounts.google.com", "https://mail.google.com/"]],
|
||||
|
||||
["imap.mail.ru", ["o2.mail.ru", "mail.imap"]],
|
||||
["smtp.mail.ru", ["o2.mail.ru", "mail.imap"]],
|
||||
|
||||
["imap.mail.yahoo.com", ["login.yahoo.com", "mail-w"]],
|
||||
["pop.mail.yahoo.com", ["login.yahoo.com", "mail-w"]],
|
||||
["smtp.mail.yahoo.com", ["login.yahoo.com", "mail-w"]],
|
||||
|
||||
["imap.aol.com", ["login.aol.com", "mail-w"]],
|
||||
["pop.aol.com", ["login.aol.com", "mail-w"]],
|
||||
["smtp.aol.com", ["login.aol.com", "mail-w"]],
|
||||
|
||||
["outlook.office365.com", [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue