GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Expose better authentication errors by blakeembrey · Pull Request #1742 · python-kasa/python-kasa ConversationI was trying to set up the P316M but run into a bunch of issues, these failures would have helped me a lot earlier. I'm sure it could still be further improved, but it's what worked for me. Debug process:
Prior to diving into this package I had assumed the board was either broken or unsupported. I tried more than I should have to re-authenticate in the home assistant UI.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@ ## master #1742 +/- ## ========================================== - Coverage 93.29% 93.27% -0.02% ========================================== Files 157 157 Lines 9932 9967 +35 Branches 1022 1030 +8 ========================================== + Hits 9266 9297 +31 - Misses 471 473 +2 - Partials 195 197 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hi @blakeembrey and thanks for your PR! I think this would be really useful addition, I added a couple of things that should be taken care of before this can be merged.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return error | ||
|
|
||
| @staticmethod | ||
| def _is_owner_hash(owner: Any) -> TypeGuard[str]: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could we avoid typeguard import, set correct type for the input parameter, and make it return a regular bool?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| supplied_owner = hashlib.md5( # noqa: S324 | ||
| credentials.username.encode() | ||
| ).hexdigest() | ||
| if supplied_owner.casefold() != owner.casefold(): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Would you mind moving this logic into a better place (likely to the corresponding auth protocol) and make it reusable?
Logic to detect mistyped username (I always assumed it'd be incorrect casing) would be useful, and we could try that to help people with issues like:
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Requested changes must be addressed to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.