Bug 1593122 - "[autoconfig] Status area goes blank while running guess config" [r=mkmelin, ui-r=alessandro]
authorBen Bucksch <ben.bucksch@beonex.com>
Wed, 04 Dec 2019 12:30:10 +0200
changeset 82245 2b0257c0f794ce26c10658674b961f8a4c0bb883
parent 82244 65f427004ab5069157866f97a95f7ec6992c8c60
child 82246 792c378e19bcedb1a164a6621d0e734f7236a88d
push id9940
push usergeoff@darktrojan.net
push dateWed, 04 Dec 2019 22:28:38 +0000
treeherdertry-comm-central@3c37719f7f34 [default view] [failures only]
reviewersmkmelin, alessandro
bugs1593122
Bug 1593122 - "[autoconfig] Status area goes blank while running guess config" [r=mkmelin, ui-r=alessandro]
mail/components/accountcreation/content/emailWizard.js
--- a/mail/components/accountcreation/content/emailWizard.js
+++ b/mail/components/accountcreation/content/emailWizard.js
@@ -621,21 +621,21 @@ EmailConfigWizard.prototype = {
     var priority = (this._abortable = new PriorityOrderAbortable(
       function(config, call) {
         // success
         self._abortable = null;
         self.removeStatusLines();
         self.stopSpinner(call.foundMsg);
         self.foundConfig(config);
       },
-      function(e) {
+      function(e, allErrors) {
         // all failed
         self._abortable = null;
         self.removeStatusLines();
-        if (e instanceof CancelledException) {
+        if (allErrors.some(e => e instanceof CancelledException)) {
           return;
         }
 
         // guess config
         let initialConfig = new AccountConfig();
         self._prefillConfig(initialConfig);
         self._guessConfig(domain, initialConfig);
       }
@@ -691,25 +691,28 @@ EmailConfigWizard.prototype = {
       fetch = fetchConfigFromExchange(
         domain,
         emailAddress,
         this._exchangeUsername,
         this._password,
         call.successCallback(),
         (e, allErrors) => {
           // Must call error callback in any case to stop the discover mode.
-          call.errorCallback()(e); // ()(e) is correct
-          if (
-            e.code == 401 ||
-            (allErrors && allErrors.find(e => e.code == 401))
-          ) {
-            // Auth failed
+          let errorCallback = call.errorCallback();
+          if (allErrors.some(e => e.code == 401)) {
+            // Auth failed.
             // Ask user for username.
+            this.onStartOver();
+            this.stopSpinner(); // clears status message
             _show("usernameRow");
-            this.switchToMode("start");
+            _show("status-area");
+            _enable("manual-edit_button");
+            errorCallback(new CancelledException());
+          } else {
+            errorCallback(e);
           }
         }
       );
       call.setAbortable(fetch);
     } catch (e) {
       // e.g. when entering an invalid domain like "c@c.-com"
       this.showErrorMsg(e);
       this.removeStatusLines();