From 453effb96eba97213da277a55f9ad55b176dbc15 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 23 Mar 2012 01:29:49 -0700 Subject: [PATCH] Parameters must be passed along to configs servlet. Connection URLs need not contain authentication parameters, as they will already have been passed to the configs servlet. Forward parameters along to login servlet if available. --- src/main/webapp/index.xhtml | 23 +++++++++++++---------- src/main/webapp/scripts/connections.js | 8 ++++++-- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/main/webapp/index.xhtml b/src/main/webapp/index.xhtml index f6cebd6..4ddd429 100644 --- a/src/main/webapp/index.xhtml +++ b/src/main/webapp/index.xhtml @@ -102,15 +102,8 @@ // with the given id. function getClientURL(id) { - // Get parameters from query string - var parameters = window.location.search.substring(1); - - // Construct URL for client, including any additional - // parameters from the query string - var client_url = "client.xhtml?id=" + encodeURIComponent(id); - if (parameters) client_url += "&" + parameters; - - return client_url; + // Construct URL for client with given id + return "client.xhtml?id=" + encodeURIComponent(id); } @@ -121,9 +114,12 @@ // authenticated. function resetUI() { + // Get parameters from query string + var parameters = window.location.search.substring(1); + var configs; try { - configs = getConfigList(); + configs = getConfigList(parameters); } catch (e) { @@ -196,6 +192,10 @@ loginForm.onsubmit = function() { + // Get parameters from query string + var parameters = window.location.search.substring(1); + + // Get username and password from form var username = document.getElementById("username"); var password = document.getElementById("password"); @@ -203,6 +203,9 @@ "username=" + encodeURIComponent(username.value) + "&password=" + encodeURIComponent(password.value) + // Include query parameters in submission data + if (parameters) data += "&" + parameters; + try { // Log in diff --git a/src/main/webapp/scripts/connections.js b/src/main/webapp/scripts/connections.js index 98f2a37..77fd05d 100644 --- a/src/main/webapp/scripts/connections.js +++ b/src/main/webapp/scripts/connections.js @@ -5,11 +5,15 @@ function Config(protocol, id) { this.id = id; } -function getConfigList() { +function getConfigList(parameters) { + + // Construct request URL + var configs_url = "configs"; + if (parameters) configs_url += "?" + parameters; // Get config list var xhr = new XMLHttpRequest(); - xhr.open("GET", "configs", false); + xhr.open("GET", configs_url, false); xhr.send(null); // If fail, throw error -- 1.7.10.4