-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Captcha for BMW North America #129667
Closed
+319
−18
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5c25177
Add external flow for captcha
rikroe 8372090
Add/fix tests
rikroe 5b01b89
Raise reauth flow with captcha-specific error message
rikroe 37aa8fd
Cleanup
rikroe 4119250
Bump bimmer_connected to 0.16.4
rikroe 7a29c92
Merge branch 'dev' into bmw-hcaptcha-token
rikroe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
CONF_ACCOUNT = "account" | ||
CONF_REFRESH_TOKEN = "refresh_token" | ||
CONF_GCID = "gcid" | ||
CONF_CAPTCHA_TOKEN = "hcaptcha_token" | ||
|
||
DATA_HASS_CONFIG = "hass_config" | ||
|
||
|
@@ -27,3 +28,20 @@ | |
"north_america": 600, | ||
"rest_of_world": 300, | ||
} | ||
|
||
TEMPLATE_HCAPTCHA = """<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>hCaptcha</title> | ||
</head> | ||
<body> | ||
<form id="captcha" action="{return_url}" method="post"> | ||
<center> | ||
<div class="h-captcha" data-sitekey="{sitekey}"></div><br> | ||
<button type="submit">Submit</button> | ||
</center> | ||
</form> | ||
<script src="https://hcaptcha.com/1/api.js" async defer></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. External javascript included into the Home Assistant frontend. |
||
</body> | ||
</html>""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move that to
view.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept it in
config_flow.py
as I got many ideas from the Plex integration.There, the views related to the config flow are in
config_flow.py
and only views that are used after component initialization are inviews.py
.Maybe someone from the core team can give some feedback here as well because it seems this is the first time an actual HTML page is rendered from HA - I was only able to find images/API-like functionality.