From 18e240c4db12e385c79658471222a05e445cd95b Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 19 Jun 2024 22:31:58 +0200 Subject: [PATCH] Try to use the CLI password for logins (if enabled and readable by the current user) Signed-off-by: DL6ER --- padd.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/padd.sh b/padd.sh index 9936aaa..9610fe7 100755 --- a/padd.sh +++ b/padd.sh @@ -169,9 +169,15 @@ TestAPIAvailability() { } LoginAPI() { - # Try to authenticate - Authenticate + # Try to read the CLI password (if enabled and readable by the current user) + if [ -r /etc/pihole/cli_pw ]; then + password=$(cat /etc/pihole/cli_pw) + # Try to authenticate using the CLI password + Authenticate + fi + + # If this did not work, ask the user for the password while [ "${validSession}" = false ] || [ -z "${validSession}" ] ; do moveXOffset; echo "Authentication failed."