Block empty form submissions
Signed-off-by: Georg <georg@lysergic.dev>
This commit is contained in:
parent
7885aa340c
commit
6a0442c8f2
64
pounceman.sh
64
pounceman.sh
@ -16,13 +16,13 @@ menu() {
|
|||||||
"1" "Edit active networks" \
|
"1" "Edit active networks" \
|
||||||
"2" "Edit disabled networks" \
|
"2" "Edit disabled networks" \
|
||||||
"3" "Add new network" \
|
"3" "Add new network" \
|
||||||
"4" "Enable network (deprecated)" \
|
|
||||||
"5" "Disable network (deprecated)" \
|
|
||||||
"6" "Manage client certificates" \
|
"6" "Manage client certificates" \
|
||||||
2>&1 1>&3)
|
2>&1 1>&3)
|
||||||
exit_status=$?
|
exit_status=$?
|
||||||
exec 3>&-
|
exec 3>&-
|
||||||
}
|
}
|
||||||
|
# "4" "Enable network (deprecated)" \
|
||||||
|
# "5" "Disable network (deprecated)" \
|
||||||
|
|
||||||
get_networks() {
|
get_networks() {
|
||||||
exec 3>&1
|
exec 3>&1
|
||||||
@ -173,18 +173,25 @@ remove_network() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_network() {
|
add_network() {
|
||||||
|
tmp_name=""
|
||||||
|
tmp_hostname=""
|
||||||
|
tmp_nickname=""
|
||||||
|
tmp_password=""
|
||||||
|
tmp_channels=""
|
||||||
|
tmp_away=""
|
||||||
|
while [[ -z $tmp_name || -z $tmp_hostname || -z $tmp_nickname || -z $tmp_password || -z $tmp_channels || -z $tmp_away ]]; do
|
||||||
exec 3>&1
|
exec 3>&1
|
||||||
user_input=$(dialog --ok-label "Submit" \
|
user_input=$(dialog --ok-label "Submit" \
|
||||||
--backtitle "LibertaCasa IRC Services - Pounce Division - https://liberta.casa/" \
|
--backtitle "LibertaCasa IRC Services - Pounce Division - https://liberta.casa/" \
|
||||||
--title "New IRC Network" \
|
--title "New IRC Network" \
|
||||||
--form "Network specific details:" \
|
--form "Network specific details:" \
|
||||||
20 50 0 \
|
20 50 0 \
|
||||||
"Arbitrary name:" 1 1 "$nw_name" 1 18 33 0 \
|
"Arbitrary name:" 1 1 "$tmp_name" 1 18 33 0 \
|
||||||
"Hostname:" 2 1 "$nw_hostname" 2 18 33 0 \
|
"Hostname:" 2 1 "$tmp_hostname" 2 18 33 0 \
|
||||||
"Nickname:" 3 1 "$nw_nickname" 3 18 33 0 \
|
"Nickname:" 3 1 "$tmp_nickname" 3 18 33 0 \
|
||||||
"SASL Password:" 4 1 "$nw_password" 4 18 33 0 \
|
"SASL Password:" 4 1 "$tmp_password" 4 18 33 0 \
|
||||||
"Channels:" 5 1 "$nw_channels" 5 18 33 0 \
|
"Channels:" 5 1 "$tmp_channels" 5 18 33 0 \
|
||||||
"Away message:" 6 1 "$nw_away" 6 18 33 0 \
|
"Away message:" 6 1 "$tmp_away" 6 18 33 0 \
|
||||||
2>&1 1>&3)
|
2>&1 1>&3)
|
||||||
#3>&1 1>&2 2>&3 3>&-)
|
#3>&1 1>&2 2>&3 3>&-)
|
||||||
exec 3>&-
|
exec 3>&-
|
||||||
@ -195,6 +202,7 @@ add_network() {
|
|||||||
tmp_password=$(echo "$user_input" | sed -n 4p)
|
tmp_password=$(echo "$user_input" | sed -n 4p)
|
||||||
tmp_channels=$(echo "$user_input" | sed -n 5p)
|
tmp_channels=$(echo "$user_input" | sed -n 5p)
|
||||||
tmp_away=$(echo "$user_input" | sed -n 6p)
|
tmp_away=$(echo "$user_input" | sed -n 6p)
|
||||||
|
done
|
||||||
if [ ! $tmp_name = "TEMPLATE" ]; then
|
if [ ! $tmp_name = "TEMPLATE" ]; then
|
||||||
cp $pouncedir/TEMPLATE $pouncedir/users/$USER/disabled/$tmp_name
|
cp $pouncedir/TEMPLATE $pouncedir/users/$USER/disabled/$tmp_name
|
||||||
sed -e "s+%%POUNCEDIR%%+$pouncedir+" -i $pouncedir/users/$USER/disabled/$tmp_name
|
sed -e "s+%%POUNCEDIR%%+$pouncedir+" -i $pouncedir/users/$USER/disabled/$tmp_name
|
||||||
@ -311,9 +319,9 @@ get_certs() {
|
|||||||
0 )
|
0 )
|
||||||
add_cert
|
add_cert
|
||||||
;;
|
;;
|
||||||
1 )
|
#1 )
|
||||||
get_certs
|
# get_certs
|
||||||
;;
|
# ;;
|
||||||
esac
|
esac
|
||||||
crt_choice=""
|
crt_choice=""
|
||||||
fi
|
fi
|
||||||
@ -329,7 +337,17 @@ add_cert() {
|
|||||||
10 60 \
|
10 60 \
|
||||||
2>&1 1>&3)
|
2>&1 1>&3)
|
||||||
echo $crt_input > /tmp/crtinput
|
echo $crt_input > /tmp/crtinput
|
||||||
|
case $crt_input in
|
||||||
|
"")
|
||||||
|
dialog --title "Error" \
|
||||||
|
--backtitle "LibertaCasa Pounce Configurator" \
|
||||||
|
--msgbox "Did you supply a name for the new certificate?" \
|
||||||
|
10 60
|
||||||
|
;;
|
||||||
|
*)
|
||||||
/usr/local/bin/pounce -a $pouncedir/users/$USER/certs/ca.pem -g $pouncedir/users/$USER/certs/$crt_input.pem
|
/usr/local/bin/pounce -a $pouncedir/users/$USER/certs/ca.pem -g $pouncedir/users/$USER/certs/$crt_input.pem
|
||||||
|
;;
|
||||||
|
esac
|
||||||
crt_input = ""
|
crt_input = ""
|
||||||
exec 3>&-
|
exec 3>&-
|
||||||
get_certs
|
get_certs
|
||||||
@ -387,18 +405,18 @@ while true; do
|
|||||||
3 )
|
3 )
|
||||||
add_network
|
add_network
|
||||||
;;
|
;;
|
||||||
4 )
|
# 4 )
|
||||||
get_networks "disabled"
|
# get_networks "disabled"
|
||||||
if [ ! -z "$user_choice" ]; then
|
# if [ ! -z "$user_choice" ]; then
|
||||||
set_network "disabled"
|
# set_network "disabled"
|
||||||
fi
|
# fi
|
||||||
;;
|
# ;;
|
||||||
5 )
|
# 5 )
|
||||||
get_networks "enabled"
|
# get_networks "enabled"
|
||||||
if [ ! -z "$user_choice" ]; then
|
# if [ ! -z "$user_choice" ]; then
|
||||||
set_network "enabled"
|
# set_network "enabled"
|
||||||
fi
|
# fi
|
||||||
;;
|
# ;;
|
||||||
6 )
|
6 )
|
||||||
certman
|
certman
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user