Skip to content

Commit

Permalink
Try to use the CLI password for logins (if enabled and readable by th…
Browse files Browse the repository at this point in the history
…e current user)

Signed-off-by: DL6ER <dl6er@dl6er.de>
  • Loading branch information
DL6ER committed Jun 20, 2024
1 parent 3306095 commit 0ca0a5b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions padd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,21 @@ 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 wasn't successful or no CLI password is available, try to
# authenticate without a password
if [ "${validSession}" = false ] || [ -z "${validSession}" ]; then
Authenticate
fi

# If this did not work, ask the user for the password
while [ "${validSession}" = false ] || [ -z "${validSession}" ] ; do
moveXOffset; echo "Authentication failed."

Expand Down

0 comments on commit 0ca0a5b

Please sign in to comment.