Check for valid user

This commit is contained in:
Bob Mottram 2016-11-12 13:59:33 +00:00
parent 6408c20b0c
commit f663b89f16
2 changed files with 36 additions and 16 deletions

View File

@ -53,6 +53,22 @@ hubzilla_variables=(ONION_ONLY
HUBZILLA_ADDONS_REPO HUBZILLA_ADDONS_REPO
HUBZILLA_ADDONS_COMMIT) HUBZILLA_ADDONS_COMMIT)
function remove_user_hubzilla {
remove_username="$1"
}
function add_user_hubzilla {
if [[ $(app_is_installed hubzilla) == "0" ]]; then
echo '0'
return
fi
new_username="$1"
new_user_password="$2"
echo '0'
}
function hubzilla_renew_cert { function hubzilla_renew_cert {
dialog --title $"Renew SSL certificate" \ dialog --title $"Renew SSL certificate" \
--backtitle $"Freedombone Control Panel" \ --backtitle $"Freedombone Control Panel" \

View File

@ -467,6 +467,7 @@ function add_users_after_install {
for d in /home/*/ ; do for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}') USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
if [[ "$USERNAME" != "$ADMIN_USERNAME" ]]; then if [[ "$USERNAME" != "$ADMIN_USERNAME" ]]; then
if [[ $(user_added_to_app "${USERNAME}" "${app_name}") == "0" ]]; then if [[ $(user_added_to_app "${USERNAME}" "${app_name}") == "0" ]]; then
valstr=$"Login for user ${USERNAME}=" valstr=$"Login for user ${USERNAME}="
@ -481,6 +482,7 @@ function add_users_after_install {
chown ${ADMIN_USERNAME}:${ADMIN_USERNAME} /home/${ADMIN_USERNAME}/README chown ${ADMIN_USERNAME}:${ADMIN_USERNAME} /home/${ADMIN_USERNAME}/README
fi fi
fi fi
fi
done done
} }
@ -491,6 +493,7 @@ function remove_users_for_app {
for d in /home/*/ ; do for d in /home/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $3}') USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
if [[ "$USERNAME" != "$MY_USERNAME" ]]; then if [[ "$USERNAME" != "$MY_USERNAME" ]]; then
if [[ $(user_added_to_app "${USERNAME}" "${app_name}") == "1" ]]; then if [[ $(user_added_to_app "${USERNAME}" "${app_name}") == "1" ]]; then
if [[ $(function_exists remove_user_${app_name}) == "1" ]]; then if [[ $(function_exists remove_user_${app_name}) == "1" ]]; then
@ -499,6 +502,7 @@ function remove_users_for_app {
sed -i "/${app_name}_${USERNAME}/d" $APP_USERS_FILE sed -i "/${app_name}_${USERNAME}/d" $APP_USERS_FILE
fi fi
fi fi
fi
done done
} }