summaryrefslogtreecommitdiffstats
path: root/mailnews/base/prefs/content/accountcreation/emailWizard.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-05 18:27:14 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-05 18:27:14 -0500
commit03590a6711d601ef3ddb48787e9f3f556705b5db (patch)
treeb5985c23741cd03fd0ed32537773e07db2d7d21d /mailnews/base/prefs/content/accountcreation/emailWizard.js
parent714afc76f690ba11e77330e067e5bce486292831 (diff)
downloadUXP-03590a6711d601ef3ddb48787e9f3f556705b5db.tar
UXP-03590a6711d601ef3ddb48787e9f3f556705b5db.tar.gz
UXP-03590a6711d601ef3ddb48787e9f3f556705b5db.tar.lz
UXP-03590a6711d601ef3ddb48787e9f3f556705b5db.tar.xz
UXP-03590a6711d601ef3ddb48787e9f3f556705b5db.zip
Issue #1258 - Part 8: Ifdef MailNews OAuth2 Support
Use --disable-mailnews-oauth2 to exclude it. Confvars won't be respected.
Diffstat (limited to 'mailnews/base/prefs/content/accountcreation/emailWizard.js')
-rw-r--r--mailnews/base/prefs/content/accountcreation/emailWizard.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/mailnews/base/prefs/content/accountcreation/emailWizard.js b/mailnews/base/prefs/content/accountcreation/emailWizard.js
index b4e6854da..389feab6c 100644
--- a/mailnews/base/prefs/content/accountcreation/emailWizard.js
+++ b/mailnews/base/prefs/content/accountcreation/emailWizard.js
@@ -6,7 +6,9 @@
Components.utils.import("resource:///modules/mailServices.js");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource:///modules/hostnameUtils.jsm");
+#ifdef MOZ_MAILNEWS_OAUTH2
Components.utils.import("resource://gre/modules/OAuth2Providers.jsm");
+#endif
/**
* This is the dialog opened by menu File | New account | Mail... .
@@ -184,7 +186,9 @@ EmailConfigWizard.prototype =
"authPasswordEncrypted");
setLabelFromStringBundle("in-authMethod-kerberos", "authKerberos");
setLabelFromStringBundle("in-authMethod-ntlm", "authNTLM");
+#ifdef MOZ_MAILNEWS_OAUTH2
setLabelFromStringBundle("in-authMethod-oauth2", "authOAuth2");
+#endif
setLabelFromStringBundle("out-authMethod-no", "authNo");
setLabelFromStringBundle("out-authMethod-password-cleartext",
"authPasswordCleartextViaSSL"); // will warn about insecure later
@@ -1014,7 +1018,11 @@ EmailConfigWizard.prototype =
e("incoming_ssl").value = sanitize.enum(config.incoming.socketType,
[ 0, 1, 2, 3 ], 0);
e("incoming_authMethod").value = sanitize.enum(config.incoming.auth,
+#ifdef MOZ_MAILNEWS_OAUTH2
[ 0, 3, 4, 5, 6, 10 ], 0);
+#else
+ [ 0, 3, 4, 5, 6 ], 0);
+#endif
e("incoming_username").value = config.incoming.username;
if (config.incoming.port) {
e("incoming_port").value = config.incoming.port;
@@ -1023,6 +1031,7 @@ EmailConfigWizard.prototype =
}
this.fillPortDropdown(config.incoming.type);
+#ifdef MOZ_MAILNEWS_OAUTH2
// If the hostname supports OAuth2 and imap is enabled, enable OAuth2.
let iDetails = OAuth2Providers.getHostnameDetails(config.incoming.hostname);
gEmailWizardLogger.info("OAuth2 details for incoming hostname " +
@@ -1035,6 +1044,7 @@ EmailConfigWizard.prototype =
// store them in the base configuration.
this._currentConfig.oauthSettings = config.oauthSettings;
}
+#endif
// outgoing server
e("outgoing_hostname").value = config.outgoing.hostname;
@@ -1052,6 +1062,7 @@ EmailConfigWizard.prototype =
this.adjustOutgoingPortToSSLAndProtocol(config);
}
+#ifdef MOZ_MAILNEWS_OAUTH2
// If the hostname supports OAuth2 and imap is enabled, enable OAuth2.
let oDetails = OAuth2Providers.getHostnameDetails(config.outgoing.hostname);
gEmailWizardLogger.info("OAuth2 details for outgoing hostname " +
@@ -1064,6 +1075,7 @@ EmailConfigWizard.prototype =
// store them in the base configuration.
this._currentConfig.oauthSettings = config.oauthSettings;
}
+#endif
// populate fields even if existingServerKey, in case user changes back
if (config.outgoing.existingServerKey) {
@@ -1614,10 +1626,12 @@ EmailConfigWizard.prototype =
self._currentConfig.incoming.username = successfulConfig.incoming.username;
self._currentConfig.outgoing.username = successfulConfig.outgoing.username;
+#ifdef MOZ_MAILNEWS_OAUTH2
// We loaded dynamic client registration, fill this data back in to the
// config set.
if (successfulConfig.oauthSettings)
self._currentConfig.oauthSettings = successfulConfig.oauthSettings;
+#endif
self.finish();
},