From e12fd7a87e704bf77b19da96be3b7f9049acbd95 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Dec 2015 14:38:17 +0000 Subject: [PATCH] IRC password can be changed within control panel --- src/freedombone-controlpanel | 70 ++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 15 deletions(-) diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index dcafb8ad..0daf2cf6 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -189,6 +189,22 @@ function change_password { any_key } +function irc_set_global_password { + dialog --title $"IRC Password" \ + --clear \ + --backtitle $"Freedombone Control Panel" \ + --passwordbox $"Password for all IRC users" 10 50 2> $data + sel=$? + case $sel in + 0) + NEW_IRC_PASSWORD=$(<$data) + sed -i "0,/RE/s/Password =.*/Password = $NEW_IRC_PASSWORD/" /etc/ngircd/ngircd.conf + dialog --title $"IRC Password" \ + --msgbox $"The IRC password was changed" 6 40 + ;; + esac +} + function change_ssh_public_key { select_user if [ ! $SELECTED_USERNAME ]; then @@ -1013,6 +1029,28 @@ function menu_media { done } +function menu_irc { + while true + do + data=$(tempfile 2>/dev/null) + trap "rm -f $data" 0 1 2 5 15 + dialog --backtitle $"Freedombone Control Panel" \ + --title $"IRC Menu" \ + --radiolist $"Choose an operation:" 13 70 3 \ + 1 $"Set a password for all IRC users" off \ + 2 $"Exit" on 2> $data + sel=$? + case $sel in + 1) break;; + 255) break;; + esac + case $(cat $data) in + 1) irc_set_global_password;; + 2) break;; + esac + done +} + function menu_top_level { while true do @@ -1020,7 +1058,7 @@ function menu_top_level { trap "rm -f $data" 0 1 2 5 15 dialog --backtitle $"Freedombone Control Panel" \ --title $"Control Panel" \ - --radiolist $"Choose an operation:" 23 70 16 \ + --radiolist $"Choose an operation:" 24 70 17 \ 1 $"Backup and Restore" off \ 2 $"Show SIP Phone Extensions" off \ 3 $"Reset Tripwire" off \ @@ -1030,13 +1068,14 @@ function menu_top_level { 7 $"Security Settings" off \ 8 $"Hubzilla" off \ 9 $"Media menu" off \ - 10 $"Change the name of this system" off \ - 11 $"Set the TLS date/time source" off \ - 12 $"Set a static local IP address" off \ - 13 $"Check for updates" off \ - 14 $"Power off the system" off \ - 15 $"Restart the system" off \ - 16 $"Exit" on 2> $data + 10 $"IRC menu" off \ + 11 $"Change the name of this system" off \ + 12 $"Set the TLS date/time source" off \ + 13 $"Set a static local IP address" off \ + 14 $"Check for updates" off \ + 15 $"Power off the system" off \ + 16 $"Restart the system" off \ + 17 $"Exit" on 2> $data sel=$? case $sel in 1) exit 1;; @@ -1052,13 +1091,14 @@ function menu_top_level { 7) security_settings;; 8) menu_hubzilla;; 9) menu_media;; - 10) change_system_name;; - 11) set_tls_time_source;; - 12) set_static_IP;; - 13) check_for_updates;; - 14) shut_down_system;; - 15) restart_system;; - 16) break;; + 10) menu_irc;; + 11) change_system_name;; + 12) set_tls_time_source;; + 13) set_static_IP;; + 14) check_for_updates;; + 15) shut_down_system;; + 16) restart_system;; + 17) break;; esac done }