Browse code

[tbird] COAX-236 Fix: do not remove stored login/password on server error when opening calendar tab.

Nicolas Lascombes authored on 05/02/2016 15:20:50
Showing 1 changed files
... ...
@@ -121,21 +121,21 @@ var gBMOverlay = {
121 121
 				data);
122 122
     },
123 123
     _onAuth: function(aReq, aData) {
124
-	if (aReq.responseText.indexOf("<meta name=\"X-BM-Page\" content=\"maintenance\"/>") != -1) {
125
-	    this._logger.info("BM server is in maintenance");
126
-	    this._openWebCalendar(aData.server, null, aData.background);
127
-	} else {
128
-	    let ssoCookie = aReq.getResponseHeader("BMSsoCookie");
129
-	    this._logger.debug("ssoCookie:" + ssoCookie);
130
-	    if (!ssoCookie) {
131
-		bmUtils.promptService.alert(null, bmUtils.getLocalizedString("dialogs.title"),
132
-				    bmUtils.getLocalizedString("errors.credentials"));
133
-		bmUtils.removeCredentialStored(aData.server);
134
-		bmUtils.session.password = null;
135
-	    } else {
136
-		this._openWebCalendar(aData.server, ssoCookie, aData.background);
137
-	    }
138
-	}
124
+        if (aReq.responseText.indexOf("<meta name=\"X-BM-Page\" content=\"maintenance\"/>") != -1) {
125
+            this._logger.info("BM server is in maintenance");
126
+            this._openWebCalendar(aData.server, null, aData.background);
127
+        } else {
128
+            let ssoCookie = aReq.getResponseHeader("BMSsoCookie");
129
+            this._logger.debug("ssoCookie:" + ssoCookie);
130
+            if (!ssoCookie && aReq.responseText.indexOf("Login failed for user") != -1) {
131
+                bmUtils.promptService.alert(null, bmUtils.getLocalizedString("dialogs.title"),
132
+                            bmUtils.getLocalizedString("errors.credentials"));
133
+                bmUtils.removeCredentialStored(aData.server);
134
+                bmUtils.session.password = null;
135
+            } else {
136
+                this._openWebCalendar(aData.server, ssoCookie, aData.background);
137
+            }
138
+        }
139 139
     },
140 140
     _getBmCalendarTab: function() {
141 141
 	let tabmail = document.getElementById("tabmail");