Преглед изворни кода

Changing calendar passwords

Bob Mottram пре 8 година
родитељ
комит
6395234ec6
1 измењених фајлова са 13 додато и 6 уклоњено
  1. 13
    6
      src/freedombone-app-radicale

+ 13
- 6
src/freedombone-app-radicale Прегледај датотеку

@@ -51,8 +51,8 @@ radicale_variables=(ONION_ONLY
51 51
 
52 52
 function remove_user_radicale {
53 53
     remove_username="$1"
54
-    if grep "$remove_username:" ${RADICALE_USERS}; then
55
-        sed -i "/$remove_username:/d" ${RADICALE_USERS}
54
+    if grep "${remove_username}:" ${RADICALE_USERS}; then
55
+        sed -i "/${remove_username}:/d" ${RADICALE_USERS}
56 56
         if [ -d /var/www/radicale/collections/${remove_username} ]; then
57 57
             rm -rf /var/www/radicale/collections/${remove_username}
58 58
         fi
@@ -87,13 +87,20 @@ function add_user_radicale {
87 87
     echo '0'
88 88
 }
89 89
 
90
-function install_interactive_radicale {
91
-    echo -n ''
92
-    APP_INSTALLED=1
90
+function change_password_radicale {
91
+    existing_username="$1"
92
+    new_user_password="$2"
93
+
94
+    if grep "${existing_username}:" ${RADICALE_USERS}; then
95
+        sed -i "/${existing_username}:/d" ${RADICALE_USERS}
96
+        htpasswd -bd ${RADICALE_USERS} "$existing_username" "$new_user_password"
97
+        systemctl reload radicale
98
+    fi
93 99
 }
94 100
 
95
-function change_password_radicale {
101
+function install_interactive_radicale {
96 102
     echo -n ''
103
+    APP_INSTALLED=1
97 104
 }
98 105
 
99 106
 function reconfigure_radicale {