mirror of
				https://github.com/python-kasa/python-kasa.git
				synced 2025-11-03 22:22:06 +00:00 
			
		
		
		
	Improve exception messages on credential mismatches (#1417)
	
		
			
	
		
	
	
		
	
		
			Some checks are pending
		
		
	
	
		
			
				
	
				CI / Perform linting checks (3.13) (push) Waiting to run
				
			
		
			
				
	
				CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.11) (push) Blocked by required conditions
				
			
		
			
				
	
				CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.12) (push) Blocked by required conditions
				
			
		
			
				
	
				CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.13) (push) Blocked by required conditions
				
			
		
			
				
	
				CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.11) (push) Blocked by required conditions
				
			
		
			
				
	
				CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.12) (push) Blocked by required conditions
				
			
		
			
				
	
				CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.13) (push) Blocked by required conditions
				
			
		
			
				
	
				CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.11) (push) Blocked by required conditions
				
			
		
			
				
	
				CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.12) (push) Blocked by required conditions
				
			
		
			
				
	
				CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.13) (push) Blocked by required conditions
				
			
		
			
				
	
				CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.11) (push) Blocked by required conditions
				
			
		
			
				
	
				CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.12) (push) Blocked by required conditions
				
			
		
			
				
	
				CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.13) (push) Blocked by required conditions
				
			
		
			
				
	
				CodeQL checks / Analyze (python) (push) Waiting to run
				
			
		
		
	
	
				
					
				
			
		
			Some checks are pending
		
		
	
	CI / Perform linting checks (3.13) (push) Waiting to run
				
			CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.11) (push) Blocked by required conditions
				
			CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.12) (push) Blocked by required conditions
				
			CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.13) (push) Blocked by required conditions
				
			CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.11) (push) Blocked by required conditions
				
			CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.12) (push) Blocked by required conditions
				
			CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.13) (push) Blocked by required conditions
				
			CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.11) (push) Blocked by required conditions
				
			CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.12) (push) Blocked by required conditions
				
			CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.13) (push) Blocked by required conditions
				
			CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.11) (push) Blocked by required conditions
				
			CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.12) (push) Blocked by required conditions
				
			CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.13) (push) Blocked by required conditions
				
			CodeQL checks / Analyze (python) (push) Waiting to run
				
			This commit is contained in:
		@@ -214,8 +214,8 @@ class KlapTransport(BaseTransport):
 | 
			
		||||
 | 
			
		||||
            if default_credentials_seed_auth_hash == server_hash:
 | 
			
		||||
                _LOGGER.debug(
 | 
			
		||||
                    "Server response doesn't match our expected hash on ip %s, "
 | 
			
		||||
                    "but an authentication with %s default credentials matched",
 | 
			
		||||
                    "Device response did not match our expected hash on ip %s,"
 | 
			
		||||
                    "but an authentication with %s default credentials worked",
 | 
			
		||||
                    self._host,
 | 
			
		||||
                    key,
 | 
			
		||||
                )
 | 
			
		||||
@@ -235,13 +235,16 @@ class KlapTransport(BaseTransport):
 | 
			
		||||
 | 
			
		||||
            if blank_seed_auth_hash == server_hash:
 | 
			
		||||
                _LOGGER.debug(
 | 
			
		||||
                    "Server response doesn't match our expected hash on ip %s, "
 | 
			
		||||
                    "but an authentication with blank credentials matched",
 | 
			
		||||
                    "Device response did not match our expected hash on ip %s, "
 | 
			
		||||
                    "but an authentication with blank credentials worked",
 | 
			
		||||
                    self._host,
 | 
			
		||||
                )
 | 
			
		||||
                return local_seed, remote_seed, self._blank_auth_hash  # type: ignore
 | 
			
		||||
 | 
			
		||||
        msg = f"Server response doesn't match our challenge on ip {self._host}"
 | 
			
		||||
        msg = (
 | 
			
		||||
            f"Device response did not match our challenge on ip {self._host}, "
 | 
			
		||||
            f"check that your e-mail and password (both case-sensitive) are correct. "
 | 
			
		||||
        )
 | 
			
		||||
        _LOGGER.debug(msg)
 | 
			
		||||
        raise AuthenticationError(msg)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -603,7 +603,10 @@ class SslAesTransport(BaseTransport):
 | 
			
		||||
            _LOGGER.debug("Credentials match")
 | 
			
		||||
            return local_nonce, server_nonce, pwd_hash
 | 
			
		||||
 | 
			
		||||
        msg = f"Server response doesn't match our challenge on ip {self._host}"
 | 
			
		||||
        msg = (
 | 
			
		||||
            f"Device response did not match our challenge on ip {self._host}, "
 | 
			
		||||
            f"check that your e-mail and password (both case-sensitive) are correct. "
 | 
			
		||||
        )
 | 
			
		||||
        _LOGGER.debug(msg)
 | 
			
		||||
 | 
			
		||||
        raise AuthenticationError(msg)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user