Skip to content
Snippets Groups Projects
Commit 0f1d01af authored by Sukhbir Singh's avatar Sukhbir Singh
Browse files

Secure NNTP settings on account creation (#7847)

parent ff0bf3ca
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ overlay chrome://messenger/content/messenger.xul chrome://castironthunderbirdclu
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://castironthunderbirdclub/content/composeoverlay.xul
overlay chrome://messenger/content/accountcreation/emailWizard.xul chrome://castironthunderbirdclub/content/emailwizard.xul
overlay chrome://messenger-newsblog/content/feedAccountWizard.xul chrome://castironthunderbirdclub/content/feedwizard.xul
overlay chrome://messenger/content/AccountWizard.xul chrome://castironthunderbirdclub/content/nntpwizard.xul
component {ebd85413-18c8-4265-a708-a8890ec8d1ed} components/torbirdy.js
contract @torproject.org/torbirdy;1 {ebd85413-18c8-4265-a708-a8890ec8d1ed}
......
Components.utils.import("resource://gre/modules/Preferences.jsm");
if (!org) var org = {};
if (!org.torbirdy) org.torbirdy = {};
if (!org.torbirdy.nntpwizard) org.torbirdy.nntpwizard = new function() {
var pub = {};
pub.fixNntpPort = function(account) {
let key = account.incomingServer.key;
let pref_spec = [
// Set the port to 563 and connection security to SSL/TLS (NNTPS).
['mail.server.%serverkey%.port', 563],
['mail.server.%serverkey%.socketType', 3]
];
for each (var [pref_template, value] in pref_spec) {
let pref = pref_template.replace("%serverkey%", key);
Preferences.set(pref, value);
}
};
// This is from mailnews/base/prefs/content/AccountWizard.xul : FinishAccount().
FinishAccount = function() {
try {
var pageData = GetPageData();
var accountData= gCurrentAccountData;
if (!accountData)
{
accountData = new Object;
// Time to set the smtpRequiresUsername attribute
if (!serverIsNntp(pageData))
accountData.smtpRequiresUsername = true;
}
// we may need local folders before account is "Finished"
// if it's a pop3 account which defers to Local Folders.
verifyLocalFoldersAccount();
PageDataToAccountData(pageData, accountData);
FixupAccountDataForIsp(accountData);
// we might be simply finishing another account
if (!gCurrentAccount)
gCurrentAccount = createAccount(accountData);
// transfer all attributes from the accountdata
finishAccount(gCurrentAccount, accountData);
setupCopiesAndFoldersServer(gCurrentAccount, getCurrentServerIsDeferred(pageData), accountData);
if (gCurrentAccount.incomingServer.canBeDefaultServer)
EnableCheckMailAtStartUpIfNeeded(gCurrentAccount);
if (!document.getElementById("downloadMsgs").hidden) {
// skip the default biff, we will load messages manually if needed
window.opener.gLoadStartFolder = false;
if (document.getElementById("downloadMsgs").checked) {
window.opener.gNewAccountToLoad = gCurrentAccount; // load messages for new POP account
}
}
pub.fixNntpPort(gCurrentAccount);
// in case we crash, force us a save of the prefs file NOW
try {
MailServices.accounts.saveAccountInfo();
}
catch (ex) {
dump("Error saving account info: " + ex + "\n");
}
window.close();
if(top.okCallback)
{
var state = true;
//dump("finish callback");
top.okCallback(state);
}
}
catch(ex) {
dump("FinishAccount failed, " + ex +"\n");
}
};
return pub;
};
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://messenger/skin/accountWizard.css" type="text/css"?>
<wizard id="castironthunderbirdclub-nntpwizard-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://castironthunderbirdclub/content/nntpwizard.js" />
</wizard>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment