Explorar el Código

Only show apps whose passwords can be changed

Bob Mottram hace 8 años
padre
commit
c326dea534
Se han modificado 1 ficheros con 11 adiciones y 9 borrados
  1. 11
    9
      src/freedombone-controlpanel

+ 11
- 9
src/freedombone-controlpanel Ver fichero

146
     SELECTED_APP=
146
     SELECTED_APP=
147
     i=0
147
     i=0
148
     W=()
148
     W=()
149
+    name=()
149
     for a in "${APPS_AVAILABLE[@]}"
150
     for a in "${APPS_AVAILABLE[@]}"
150
     do
151
     do
151
-        i=$((i+1))
152
-        W+=($i "$a")
152
+        if [[ $(function_exists change_password_${a}) == "1" ]]; then
153
+            i=$((i+1))
154
+            W+=($i "$a")
155
+            name+=("$u")
156
+        fi
153
     done
157
     done
154
 
158
 
155
     selected_app_index=$(dialog --backtitle $"Freedombone Control Panel" --title $"Select App" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3)
159
     selected_app_index=$(dialog --backtitle $"Freedombone Control Panel" --title $"Select App" --menu $"Select one of the following:" 24 40 17 "${W[@]}" 3>&2 2>&1 1>&3)
156
 
160
 
157
     if [ $? -eq 0 ]; then
161
     if [ $? -eq 0 ]; then
158
-        SELECTED_APP="${APPS_INSTALLED_NAMES[$((selected_app_index-1))]}"
162
+        SELECTED_APP="${name[$((selected_app_index-1))]}"
159
     fi
163
     fi
160
 }
164
 }
161
 
165
 
182
         0)
186
         0)
183
             CURR_PASSWORD=$(<$data)
187
             CURR_PASSWORD=$(<$data)
184
             if [ ${#CURR_PASSWORD} -gt 8 ]; then
188
             if [ ${#CURR_PASSWORD} -gt 8 ]; then
185
-                if [[ $(function_exists change_password_${SELECTED_APP}) == "1" ]]; then
186
-                    ${PROJECT_NAME}-pass -u ${SELECTED_USERNAME} -a ${SELECTED_APP} -p ${CURR_PASSWORD}
187
-                    change_password_${SELECTED_APP} ${SELECTED_USERNAME} "${CURR_PASSWORD}"
188
-                    dialog --title $"Change password" \
189
-                           --msgbox $"The password was changed" 6 40
190
-                fi
189
+                ${PROJECT_NAME}-pass -u ${SELECTED_USERNAME} -a ${SELECTED_APP} -p ${CURR_PASSWORD}
190
+                change_password_${SELECTED_APP} ${SELECTED_USERNAME} "${CURR_PASSWORD}"
191
+                dialog --title $"Change password" \
192
+                       --msgbox $"The password was changed" 6 40
191
             fi
193
             fi
192
             ;;
194
             ;;
193
     esac
195
     esac