Przeglądaj źródła

IRC password can be changed within control panel

Bob Mottram 9 lat temu
rodzic
commit
e12fd7a87e
1 zmienionych plików z 55 dodań i 15 usunięć
  1. 55
    15
      src/freedombone-controlpanel

+ 55
- 15
src/freedombone-controlpanel Wyświetl plik

@@ -189,6 +189,22 @@ function change_password {
189 189
     any_key
190 190
 }
191 191
 
192
+function irc_set_global_password {
193
+    dialog --title $"IRC Password" \
194
+           --clear \
195
+           --backtitle $"Freedombone Control Panel" \
196
+           --passwordbox $"Password for all IRC users" 10 50 2> $data
197
+    sel=$?
198
+    case $sel in
199
+        0)
200
+            NEW_IRC_PASSWORD=$(<$data)
201
+            sed -i "0,/RE/s/Password =.*/Password = $NEW_IRC_PASSWORD/" /etc/ngircd/ngircd.conf
202
+            dialog --title $"IRC Password" \
203
+                   --msgbox $"The IRC password was changed" 6 40
204
+            ;;
205
+    esac
206
+}
207
+
192 208
 function change_ssh_public_key {
193 209
     select_user
194 210
     if [ ! $SELECTED_USERNAME ]; then
@@ -1013,6 +1029,28 @@ function menu_media {
1013 1029
     done
1014 1030
 }
1015 1031
 
1032
+function menu_irc {
1033
+    while true
1034
+    do
1035
+        data=$(tempfile 2>/dev/null)
1036
+        trap "rm -f $data" 0 1 2 5 15
1037
+        dialog --backtitle $"Freedombone Control Panel" \
1038
+               --title $"IRC Menu" \
1039
+               --radiolist $"Choose an operation:" 13 70 3 \
1040
+               1 $"Set a password for all IRC users" off \
1041
+               2 $"Exit" on 2> $data
1042
+        sel=$?
1043
+        case $sel in
1044
+            1) break;;
1045
+            255) break;;
1046
+        esac
1047
+        case $(cat $data) in
1048
+            1) irc_set_global_password;;
1049
+            2) break;;
1050
+        esac
1051
+    done
1052
+}
1053
+
1016 1054
 function menu_top_level {
1017 1055
     while true
1018 1056
     do
@@ -1020,7 +1058,7 @@ function menu_top_level {
1020 1058
         trap "rm -f $data" 0 1 2 5 15
1021 1059
         dialog --backtitle $"Freedombone Control Panel" \
1022 1060
                --title $"Control Panel" \
1023
-               --radiolist $"Choose an operation:" 23 70 16 \
1061
+               --radiolist $"Choose an operation:" 24 70 17 \
1024 1062
                1 $"Backup and Restore" off \
1025 1063
                2 $"Show SIP Phone Extensions" off \
1026 1064
                3 $"Reset Tripwire" off \
@@ -1030,13 +1068,14 @@ function menu_top_level {
1030 1068
                7 $"Security Settings" off \
1031 1069
                8 $"Hubzilla" off \
1032 1070
                9 $"Media menu" off \
1033
-               10 $"Change the name of this system" off \
1034
-               11 $"Set the TLS date/time source" off \
1035
-               12 $"Set a static local IP address" off \
1036
-               13 $"Check for updates" off \
1037
-               14 $"Power off the system" off \
1038
-               15 $"Restart the system" off \
1039
-               16 $"Exit" on 2> $data
1071
+               10 $"IRC menu" off \
1072
+               11 $"Change the name of this system" off \
1073
+               12 $"Set the TLS date/time source" off \
1074
+               13 $"Set a static local IP address" off \
1075
+               14 $"Check for updates" off \
1076
+               15 $"Power off the system" off \
1077
+               16 $"Restart the system" off \
1078
+               17 $"Exit" on 2> $data
1040 1079
         sel=$?
1041 1080
         case $sel in
1042 1081
             1) exit 1;;
@@ -1052,13 +1091,14 @@ function menu_top_level {
1052 1091
             7) security_settings;;
1053 1092
             8) menu_hubzilla;;
1054 1093
             9) menu_media;;
1055
-            10) change_system_name;;
1056
-            11) set_tls_time_source;;
1057
-            12) set_static_IP;;
1058
-            13) check_for_updates;;
1059
-            14) shut_down_system;;
1060
-            15) restart_system;;
1061
-            16) break;;
1094
+            10) menu_irc;;
1095
+            11) change_system_name;;
1096
+            12) set_tls_time_source;;
1097
+            13) set_static_IP;;
1098
+            14) check_for_updates;;
1099
+            15) shut_down_system;;
1100
+            16) restart_system;;
1101
+            17) break;;
1062 1102
         esac
1063 1103
     done
1064 1104
 }