Only show apps whose passwords can be changed

This commit is contained in:
Bob Mottram 2016-11-19 16:24:24 +00:00
parent 11ce88a8e5
commit c326dea534
1 changed files with 11 additions and 9 deletions

View File

@ -146,16 +146,20 @@ function passwords_show_apps {
SELECTED_APP=
i=0
W=()
name=()
for a in "${APPS_AVAILABLE[@]}"
do
i=$((i+1))
W+=($i "$a")
if [[ $(function_exists change_password_${a}) == "1" ]]; then
i=$((i+1))
W+=($i "$a")
name+=("$u")
fi
done
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)
if [ $? -eq 0 ]; then
SELECTED_APP="${APPS_INSTALLED_NAMES[$((selected_app_index-1))]}"
SELECTED_APP="${name[$((selected_app_index-1))]}"
fi
}
@ -182,12 +186,10 @@ function view_or_change_passwords {
0)
CURR_PASSWORD=$(<$data)
if [ ${#CURR_PASSWORD} -gt 8 ]; then
if [[ $(function_exists change_password_${SELECTED_APP}) == "1" ]]; then
${PROJECT_NAME}-pass -u ${SELECTED_USERNAME} -a ${SELECTED_APP} -p ${CURR_PASSWORD}
change_password_${SELECTED_APP} ${SELECTED_USERNAME} "${CURR_PASSWORD}"
dialog --title $"Change password" \
--msgbox $"The password was changed" 6 40
fi
${PROJECT_NAME}-pass -u ${SELECTED_USERNAME} -a ${SELECTED_APP} -p ${CURR_PASSWORD}
change_password_${SELECTED_APP} ${SELECTED_USERNAME} "${CURR_PASSWORD}"
dialog --title $"Change password" \
--msgbox $"The password was changed" 6 40
fi
;;
esac