Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions hole/v6.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,11 @@ async def authenticate(self):
session_data = data.get("session", {})

if not session_data.get("valid"):
raise exceptions.HoleError(
"Authentication unsuccessful: Invalid session"
# Pi-hole v6 returns HTTP 200 with valid=false for wrong passwords
# rather than HTTP 401. Raise the same exception as the 401 path so
# callers can treat both cases uniformly.
raise exceptions.HoleAuthenticationError(
"Authentication failed: Invalid password", status=200
)

self._session_id = session_data.get("sid")
Expand Down