Browse Source

Changing calendar passwords

Bob Mottram 8 years ago
parent
commit
6395234ec6
1 changed files with 13 additions and 6 deletions
  1. 13
    6
      src/freedombone-app-radicale

+ 13
- 6
src/freedombone-app-radicale View File

51
 
51
 
52
 function remove_user_radicale {
52
 function remove_user_radicale {
53
     remove_username="$1"
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
         if [ -d /var/www/radicale/collections/${remove_username} ]; then
56
         if [ -d /var/www/radicale/collections/${remove_username} ]; then
57
             rm -rf /var/www/radicale/collections/${remove_username}
57
             rm -rf /var/www/radicale/collections/${remove_username}
58
         fi
58
         fi
87
     echo '0'
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
     echo -n ''
102
     echo -n ''
103
+    APP_INSTALLED=1
97
 }
104
 }
98
 
105
 
99
 function reconfigure_radicale {
106
 function reconfigure_radicale {