mirror of
https://github.com/pi-hole/pi-hole
synced 2024-11-18 06:08:21 +00:00
Merge pull request #1355 from pmo3/development
Mask password input when changing password
This commit is contained in:
commit
57e8b7f924
@ -81,19 +81,28 @@ SetWebPassword(){
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set password only if there is one to be set
|
read -s -p "Enter New Password (Blank for no password): " PASSWORD
|
||||||
if (( ${#args[2]} > 0 )) ; then
|
echo ""
|
||||||
|
|
||||||
|
if [ "${PASSWORD}" == "" ]; then
|
||||||
|
change_setting "WEBPASSWORD" ""
|
||||||
|
echo "Password Removed"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -s -p "Confirm Password: " CONFIRM
|
||||||
|
echo ""
|
||||||
|
if [ "${PASSWORD}" == "${CONFIRM}" ] ; then
|
||||||
# Compute password hash twice to avoid rainbow table vulnerability
|
# Compute password hash twice to avoid rainbow table vulnerability
|
||||||
hash=$(echo -n ${args[2]} | sha256sum | sed 's/\s.*$//')
|
hash=$(echo -n ${PASSWORD} | sha256sum | sed 's/\s.*$//')
|
||||||
hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//')
|
hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//')
|
||||||
# Save hash to file
|
# Save hash to file
|
||||||
change_setting "WEBPASSWORD" "${hash}"
|
change_setting "WEBPASSWORD" "${hash}"
|
||||||
echo "New password set"
|
echo "New password set"
|
||||||
else
|
else
|
||||||
change_setting "WEBPASSWORD" ""
|
echo "Passwords don't match. Your password has not been changed"
|
||||||
echo "Password removed"
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessDNSSettings() {
|
ProcessDNSSettings() {
|
||||||
|
@ -1460,7 +1460,7 @@ main() {
|
|||||||
echo "::: ${pw}"
|
echo "::: ${pw}"
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: You can always change it using"
|
echo "::: You can always change it using"
|
||||||
echo "::: pihole -a -p new_password"
|
echo "::: pihole -a -p"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user