Skip to content
Snippets Groups Projects
Commit c326dea5 authored by Bob Mottram's avatar Bob Mottram
Browse files

Only show apps whose passwords can be changed

parent 11ce88a8
No related branches found
No related tags found
No related merge requests found
...@@ -146,16 +146,20 @@ function passwords_show_apps { ...@@ -146,16 +146,20 @@ function passwords_show_apps {
SELECTED_APP= SELECTED_APP=
i=0 i=0
W=() W=()
name=()
for a in "${APPS_AVAILABLE[@]}" for a in "${APPS_AVAILABLE[@]}"
do do
i=$((i+1)) if [[ $(function_exists change_password_${a}) == "1" ]]; then
W+=($i "$a") i=$((i+1))
W+=($i "$a")
name+=("$u")
fi
done 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) 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 if [ $? -eq 0 ]; then
SELECTED_APP="${APPS_INSTALLED_NAMES[$((selected_app_index-1))]}" SELECTED_APP="${name[$((selected_app_index-1))]}"
fi fi
} }
...@@ -182,12 +186,10 @@ function view_or_change_passwords { ...@@ -182,12 +186,10 @@ function view_or_change_passwords {
0) 0)
CURR_PASSWORD=$(<$data) CURR_PASSWORD=$(<$data)
if [ ${#CURR_PASSWORD} -gt 8 ]; then 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}
${PROJECT_NAME}-pass -u ${SELECTED_USERNAME} -a ${SELECTED_APP} -p ${CURR_PASSWORD} change_password_${SELECTED_APP} ${SELECTED_USERNAME} "${CURR_PASSWORD}"
change_password_${SELECTED_APP} ${SELECTED_USERNAME} "${CURR_PASSWORD}" dialog --title $"Change password" \
dialog --title $"Change password" \ --msgbox $"The password was changed" 6 40
--msgbox $"The password was changed" 6 40
fi
fi fi
;; ;;
esac esac
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment