From 419598e1d1043eb254e3c0af43c76d798fdb2b3b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 30 May 2005 12:21:30 +0000 Subject: r7106: the web interface now works completely with or without cookies. If you have cookies they will be used, otherwise you will see URLs with ?SwatSessionId=XXX on the end. (This used to be commit 104d47a7458ecf03c0d5f969eaf2a98346928679) --- swat/scripting/common.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'swat/scripting/common.js') diff --git a/swat/scripting/common.js b/swat/scripting/common.js index 8396a3adc2..13ed34346b 100644 --- a/swat/scripting/common.js +++ b/swat/scripting/common.js @@ -8,6 +8,22 @@ global.page = new Object(); /* fill in some defaults */ global.page.title = "Samba Web Administration Tool"; +/* to cope with browsers that don't support cookies we append the sessionid + to the URI */ +global.SESSIONURI = ""; +if (request['COOKIE_SUPPORT'] != "True") { + global.SESSIONURI="?SwatSessionId=" + request['SESSION_ID']; +} + +/* + possibly adjust a local URI to have the session id appended + used for browsers that don't support cookies +*/ +function session_uri(uri) { + return uri + global.SESSIONURI; +} + + /* if the browser was too dumb to set the HOST header, then set it now */ @@ -32,6 +48,7 @@ function page_footer() { include("/scripting/footer_" + global.page.pagetype + ".esp"); } + /* check if a uri is one of the 'always allowed' pages, even when not logged in This allows the login page to use the same style sheets and images @@ -40,6 +57,7 @@ function always_allowed(uri) { var allowed = new Array("/images/favicon.ico", "/images/linkpad.gif", "/images/logo.png", + "/images/logo.gif", "/style/main.css", "/style/common.css"); for (i in allowed) { @@ -102,7 +120,7 @@ function Form(name, num_elements, num_submits) f.name = name; f.element = new Array(num_elements); f.submit = new Array(num_submits); - f.action = request.REQUEST_URI; + f.action = session_uri(request.REQUEST_URI); f.class = "form"; for (i in f.element) { f.element[i] = new Object(); @@ -160,3 +178,4 @@ function display_form(f) { } write("\n"); } + -- cgit