Rename unused mkws property "service_proxy_auth" to "authenticated".
authorMike Taylor <mike@indexdata.com>
Thu, 5 Dec 2013 11:43:35 +0000 (11:43 +0000)
committerMike Taylor <mike@indexdata.com>
Thu, 5 Dec 2013 11:43:35 +0000 (11:43 +0000)
(Better describes what it does, and avoids confusion with the
mkws_config property of the same name.)
Check before running a search whether we're authenticated.
(It's because we were not that auto-searches were failing on
the first call of a new session -- the search was being sent
before the authentication response was received.)

tools/htdocs/mkws.js

index b5c1b34..62fed9a 100644 (file)
@@ -5,6 +5,7 @@
 
 // Set up namespace and some state.
 var mkws = {
+    authenticated: false,
     filters: [],
 };
 
@@ -416,6 +417,11 @@ function onFormSubmitEventHandler()
 
 function newSearch(query)
 {
+    if (!mkws.authenticated) {
+       alert("searching before authentication");
+       return;
+    }
+
     mkws.filters = []
     redraw_navi();
     resetPage();
@@ -1009,7 +1015,7 @@ function mkws_service_proxy_auth(auth_url, auth_domain) {
        }
 
        debug("Service proxy auth successfully done");
-       mkws.service_proxy_auth = true;
+       mkws.authenticated = true;
     });
 }