From 2513d202bdee69a4772d349d9d21f67877302d22 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Mon, 4 Jan 2010 06:09:13 +0000 Subject: [PATCH] first pass session support, needs to be improved git-svn-id: https://svn.code.sf.net/p/freetel/code@90 01035d8c-6547-0410-b346-abe4f91aad63 --- easy-asterisk-gui/Makefile | 2 +- easy-asterisk-gui/dashboard.js | 4 ++++ easy-asterisk-gui/dashboard.sh | 19 +++++++++++++++++-- easy-asterisk-gui/login.sh | 21 ++++++++++----------- easy-asterisk-gui/logout.sh | 12 ++++++++++++ 5 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 easy-asterisk-gui/dashboard.js create mode 100644 easy-asterisk-gui/logout.sh diff --git a/easy-asterisk-gui/Makefile b/easy-asterisk-gui/Makefile index b4afbb61..45912145 100644 --- a/easy-asterisk-gui/Makefile +++ b/easy-asterisk-gui/Makefile @@ -9,4 +9,4 @@ TESTIP=192.168.1.150 # rcp index.html root@$(TESTIP):/var/lib/asterisk/static-http/ test: - rcp login.sh dashboard.sh network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www/cgi-bin + rcp logout.sh login.sh dashboard.sh dashboard.js network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www/cgi-bin diff --git a/easy-asterisk-gui/dashboard.js b/easy-asterisk-gui/dashboard.js new file mode 100644 index 00000000..de163c23 --- /dev/null +++ b/easy-asterisk-gui/dashboard.js @@ -0,0 +1,4 @@ +function localInit() { + $('internet').innerHTML = init_internet; +} + diff --git a/easy-asterisk-gui/dashboard.sh b/easy-asterisk-gui/dashboard.sh index ea2c4d2d..a791856e 100644 --- a/easy-asterisk-gui/dashboard.sh +++ b/easy-asterisk-gui/dashboard.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -x # dashboard.sh # David Rowe 4 Jan 2010 # CGI for Easy Asterisk dashboard GUI @@ -14,6 +14,16 @@ fi # Construct the web page ------------------------------- +echo $HTTP_COOKIE | grep "loggedin" > /dev/null +if [ $? -eq 1 ]; then + echo "" + echo "" + echo '' + echo "" + echo "" + exit +fi + cat < @@ -23,7 +33,7 @@ EOF echo "" cat << EOF @@ -44,6 +54,11 @@ cat << EOF +EOF + +echo $HTTP_COOKIE +cat< EOF diff --git a/easy-asterisk-gui/login.sh b/easy-asterisk-gui/login.sh index 43021673..afe42e3f 100644 --- a/easy-asterisk-gui/login.sh +++ b/easy-asterisk-gui/login.sh @@ -37,17 +37,16 @@ else if [ $? -eq 0 ]; then # login sucessful - cat < - - Easy Asterisk - Login - - - Please wait a few seconds..... - - - -EOF + echo "Content-type: text/html" + echo "Set-Cookie: loggedin=1" + echo "" + echo "" + echo "Easy Asterisk - Login" + echo '' + echo "" + echo "Please wait a few seconds....." + echo "" + echo "" else # login failed cat <Easy Asterisk - Logout +EOF +echo $HTTP_COOKIE -- 2.25.1