From: drowe67 Date: Mon, 4 Jan 2010 03:58:01 +0000 (+0000) Subject: first pass at login screen X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=ab2fe026aa68ae75ca7fe7f30c56d4af0a7a9d1a;p=freetel-svn-tracking.git first pass at login screen git-svn-id: https://svn.code.sf.net/p/freetel/code@89 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/easy-asterisk-gui/Makefile b/easy-asterisk-gui/Makefile index d407d0ff..b4afbb61 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 network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www/cgi-bin + rcp login.sh dashboard.sh network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www/cgi-bin diff --git a/easy-asterisk-gui/dashboard.sh b/easy-asterisk-gui/dashboard.sh new file mode 100644 index 00000000..ea2c4d2d --- /dev/null +++ b/easy-asterisk-gui/dashboard.sh @@ -0,0 +1,49 @@ +#!/bin/sh +# dashboard.sh +# David Rowe 4 Jan 2010 +# CGI for Easy Asterisk dashboard GUI + +# See if we have Internet connectivity + +packet_loss=`ping google.com -c 1 -q | sed -n 's/.*received, \(.*\)% packet loss/\1/p'` +if [ $packet_loss == "0" ]; then + internet="Good"; +else + internet="Not Available"; +fi + +# Construct the web page ------------------------------- + +cat < + + + +EOF + +echo "" + +cat << EOF + +Easy Asterisk - Dashboard + +
Tells you if I can reach the Internet. If not "Good" check your network settings, in particular Gateway and DNS.
+
+ + + + + + + + + +

Dashboard

Internet Connection:
+  
+
+ +EOF + diff --git a/easy-asterisk-gui/login.sh b/easy-asterisk-gui/login.sh new file mode 100644 index 00000000..43021673 --- /dev/null +++ b/easy-asterisk-gui/login.sh @@ -0,0 +1,66 @@ +#!/bin/sh +# login.sh +# David Rowe 4 Jan 2010 +# CGI for Easy Asterisk login GUI + +user=`echo "$QUERY_STRING" | grep -oe "user=[^&?]*" | sed -n "s/user=//p"` +pass=`echo "$QUERY_STRING" | grep -oe "pass=[^&?]*" | sed -n "s/pass=//p"` + +echo $QUERY_STRING | grep user > /dev/null +if [ $? -eq 1 ]; then + # Display form ------------------------------- + + cat < + + + +EOF + cat << EOF + + Easy Asterisk - Login +
+ + + + + + + + +

Login

User:
Password:
Default is root/uClinux
+
+ +EOF +else + testuser $user $pass + if [ $? -eq 0 ]; then + + # login sucessful + cat < + + Easy Asterisk - Login + + + Please wait a few seconds..... + + + +EOF + else + # login failed + cat < + + Easy Asterisk - Login + + + Please wait a few seconds..... + + + +EOF + fi +fi + diff --git a/easy-asterisk-gui/network.sh b/easy-asterisk-gui/network.sh index 46a606e0..771cd8dc 100644 --- a/easy-asterisk-gui/network.sh +++ b/easy-asterisk-gui/network.sh @@ -1,7 +1,7 @@ #!/bin/sh # network.sh # David Rowe 4 Jan 2010 -# CGI for network GUI +# CGI for Easy Asterisk network GUI echo `date` " get_network.sh" >> /tmp/easy_gui.log @@ -52,13 +52,13 @@ echo "" cat << EOF -Network +Easy Asterisk - Network
Tells you if I can reach the Internet. If not "Good" check your network settings, in particular Gateway and DNS.
- + @@ -80,4 +80,3 @@ cat << EOF EOF -# diff --git a/easy-asterisk-gui/set_network.sh b/easy-asterisk-gui/set_network.sh index 5222625e..7ad68c6e 100755 --- a/easy-asterisk-gui/set_network.sh +++ b/easy-asterisk-gui/set_network.sh @@ -15,11 +15,11 @@ Please wait a few seconds..... EOF -dhcp=`echo "$QUERY_STRING" | grep -oe "dhcp=[^&]*" | sed -n "s/dhcp=//p"` -ipaddress=`echo "$QUERY_STRING" | grep -oe "ipaddress=[^&]*" | sed -n "s/ipaddress=//p"` -netmask=`echo "$QUERY_STRING" | grep -oe "netmask=[^&]*" | sed -n "s/netmask=//p"` -gateway=`echo "$QUERY_STRING" | grep -oe "gateway=[^&]*" | sed -n "s/gateway=//p"` -dns=`echo "$QUERY_STRING" | grep -oe "dns=[^&]*" | sed -n "s/dns=//p"` +dhcp=`echo "$QUERY_STRING" | grep -oe "dhcp=[^&?]*" | sed -n "s/dhcp=//p"` +ipaddress=`echo "$QUERY_STRING" | grep -oe "ipaddress=[^&?]*" | sed -n "s/ipaddress=//p"` +netmask=`echo "$QUERY_STRING" | grep -oe "netmask=[^&?]*" | sed -n "s/netmask=//p"` +gateway=`echo "$QUERY_STRING" | grep -oe "gateway=[^&?]*" | sed -n "s/gateway=//p"` +dns=`echo "$QUERY_STRING" | grep -oe "dns=[^&?]*" | sed -n "s/dns=//p"` echo `date` " set_network.sh $dhcp $ipaddress $netmask $gateway $dns" >> /tmp/easy_gui.log

Easy Asterisk - Network

Network

Static DHCP