summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chrome/content/accountWizard/accountWizard.js56
-rw-r--r--chrome/content/accountWizard/accountWizard.xul29
2 files changed, 27 insertions, 58 deletions
diff --git a/chrome/content/accountWizard/accountWizard.js b/chrome/content/accountWizard/accountWizard.js
index c3f8887..cca4ccb 100644
--- a/chrome/content/accountWizard/accountWizard.js
+++ b/chrome/content/accountWizard/accountWizard.js
@@ -6,6 +6,7 @@
Components.utils.import("resource:///modules/mailServices.js");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource:///modules/hostnameUtils.jsm");
+Components.utils.import("resource://gre/modules/osfile.jsm");
/**
* This is the dialog opened by menu File | New account | Mail... .
@@ -111,7 +112,7 @@ BitmaskAccountWizard.prototype =
this._email = "";
this._realname = (userFullname) ? userFullname : "";
e("realname").value = this._realname;
- this._password = "123"; // use any password for now
+ this._password = "";
this._okCallback = null;
if (window.arguments && window.arguments[0]) {
@@ -129,14 +130,6 @@ BitmaskAccountWizard.prototype =
gAccountWizardStringsBundle = e("accountWizardStrings");
gBrandShortName = e("bundle_brand").getString("brandShortName");
- // admin-locked prefs hurray
- // we do not use password for now
- //if (!Services.prefs.getBoolPref("signon.rememberSignons")) {
- // let rememberPasswordE = e("remember_password");
- // rememberPasswordE.checked = false;
- // rememberPasswordE.disabled = true;
- //}
-
// First, unhide the main window areas, and store the width,
// so that we don't resize wildly when we unhide areas.
// switchToMode() will then hide the unneeded parts again.
@@ -206,12 +199,31 @@ BitmaskAccountWizard.prototype =
{
var result = this._currentConfig.copy();
replaceVariables(result, this._realname, this._email, this._password);
- //result.rememberPassword = e("remember_password").checked &&
- // !!this._password;
result.rememberPassword = true;
return result;
},
+ /**
+ * Get the IMAP an SMTP passwords from the bitmask_tokens file
+ *
+ * if the file doesn't exist we'll use a dummy password to provide
+ * support for bitmask < 0.9.2
+ */
+ getPasswordsFromFile : function()
+ {
+ let path = OS.Path.join(OS.Constants.Path.tmpDir,
+ "bitmask_tokens",
+ this._email + ".json");
+ let file_promise = OS.File.read(path);
+ file_promise.then(data => {
+ let decoder = new TextDecoder();
+ this._password = JSON.parse(decoder.decode(data))["mail_auth"];
+ }, ex => { // error reading
+ this._password = "123";
+ });
+ return file_promise;
+ },
+
/*
* This checks if the email address is at least possibly valid, meaning it
* has an '@' before the last char.
@@ -257,11 +269,6 @@ BitmaskAccountWizard.prototype =
this.checkStartDone();
},
- onInputPassword : function()
- {
- this._password = e("password").value;
- },
-
/**
* This does very little other than to check that a name was entered at all
* Since this is such an insignificant test we should be using a very light
@@ -304,18 +311,6 @@ BitmaskAccountWizard.prototype =
},
/**
- * If the user just tabbed through the password input without entering
- * anything, set the type back to text so we don't wind up showing the
- * emptytext as bullet characters.
- */
- onBlurPassword : function()
- {
- if (!this._password) {
- e("password").type = "text";
- }
- },
-
- /**
* @see onBlurPassword()
*/
onFocusPassword : function()
@@ -345,7 +340,10 @@ BitmaskAccountWizard.prototype =
*/
onNext : function()
{
- this.fillConfig(this._domain, this._email);
+ let promise = this.getPasswordsFromFile();
+ promise.then(none => { this.fillConfig(this._domain, this._email); })
+ .catch(Components.utils.reportError);
+ return promise;
},
fillConfig : function(domain, email)
diff --git a/chrome/content/accountWizard/accountWizard.xul b/chrome/content/accountWizard/accountWizard.xul
index 134d71c..2ffbffc 100644
--- a/chrome/content/accountWizard/accountWizard.xul
+++ b/chrome/content/accountWizard/accountWizard.xul
@@ -110,35 +110,6 @@
<description id="emailerror" class="errordescription" hidden="true"/>
</hbox>
</row>
- <!-- we do not use the password for now.
- <row align="center">
- <label accesskey="&password.accesskey;"
- class="autoconfigLabel"
- value="&password.label;"
- control="password"
- tooltip="optional-password"/>
- <textbox id="password"
- class="padded"
- placeholder="&password.placeholder;"
- type="text"
- oninput="gBitmaskAccountWizard.onInputPassword();"
- onfocus="gBitmaskAccountWizard.onFocusPassword();"
- onblur="gBitmaskAccountWizard.onBlurPassword();"/>
- <hbox>
- <image id="passworderroricon"
- hidden="true"
- class="warningicon"/>
- <description id="passworderror" class="errordescription" hidden="true"/>
- </hbox>
- </row>
- <row align="center" pack="start">
- <label class="autoconfigLabel"/>
- <checkbox id="remember_password"
- label="&rememberPassword.label;"
- accesskey="&rememberPassword.accesskey;"
- checked="true"/>
- </row>
- -->
</rows>
</grid>
<spacer flex="1" />