Fix web password corruption

Signed-off-by: Adam Hill <adam@diginc.us>
This commit is contained in:
Adam Hill 2018-08-04 15:58:05 -05:00
parent 4dc3c7e2dc
commit 119999be71
No known key found for this signature in database
GPG Key ID: 2193804FCA429855
1 changed files with 19 additions and 19 deletions

View File

@ -23,7 +23,9 @@ prepare_configs() {
if [[ -e "${setupVars}" ]]; then
# update the variables in the file
sed -i.update.bak '/PIHOLE_INTERFACE/d;/IPV4_ADDRESS/d;/IPV6_ADDRESS/d;/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/QUERY_LOGGING/d;/INSTALL_WEB_SERVER/d;/INSTALL_WEB_INTERFACE/d;/LIGHTTPD_ENABLED/d;' "${setupVars}"
local USERWEBPASSWORD="${WEBPASSWORD}"
. "${setupVars}"
export WEBPASSWORD="${USERWEBPASSWORD}"
fi
# echo the information to the user
{
@ -223,25 +225,23 @@ setup_web_port() {
}
setup_web_password() {
#if ! grep -q 'WEBPASSWORD' ${setupVars}; then
if [ -z "${WEBPASSWORD+x}" ] ; then
# Not set at all, give the user a random pass
WEBPASSWORD=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
echo "Assigning random password: $WEBPASSWORD"
fi;
# Turn bash debug on while setting up password (to print it)
set -x
if [[ "$WEBPASSWORD" == "" ]] ; then
echo "" | pihole -a -p
else
pihole -a -p "$WEBPASSWORD" "$WEBPASSWORD"
fi
if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then
# Turn bash debug back off after print password setup
# (subshell to null hides printing output)
{ set +x; } 2>/dev/null
fi
#fi
if [ -z "${WEBPASSWORD+x}" ]; then
# Not set at all, give the user a random pass
WEBPASSWORD=$(tr -dc _A-Z-a-z-0-9 < /dev/urandom | head -c 8)
echo "Assigning random password: $WEBPASSWORD"
fi;
# Turn bash debug on while setting up password (to print it)
set -x
if [[ "$WEBPASSWORD" == "" ]]; then
echo "" | pihole -a -p
else
pihole -a -p "$WEBPASSWORD" "$WEBPASSWORD"
fi
if [ "${PH_VERBOSE:-0}" -gt 0 ]; then
# Turn bash debug back off after print password setup
# (subshell to null hides printing output)
{ set +x; } 2>/dev/null
fi
}
setup_ipv4_ipv6() {