-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add input elements to login page for password managers #9369
Conversation
I think this should be part of We can then directly fill We should also sync the other way btw, so if you empty the rendered input, the hidden one should also be emptied. |
Thanks for the suggestion and fast reply! It's definitely much cleaner integrating with I also figured this change can support the |
@bramkragten I rewrote as a Lit component, but I have one linting error when firing a submit event so I can tell the auth-flow component to submit the credentials. Is there any better way of sending this event than the |
You need to add that event to
|
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.
This looks good!
Thanks for the review and changes @bramkragten! I really appreciate all the time you've spent on this PR. One small issue: when The |
My code should do the same as your code? 🤔 Am I missing something? Oh I see, a timing issue... Because the 2nd change happens before |
@bramkragten is there anything left to revise here? It's working great after your changes. |
I gave up fighting the quirks that appeared in #9235 so I'm trying plan B: create input fields outside the shadow dom that password managers can see, and keep these new fields in sync with the existing ones.
Proposed change
The new
ha-password-manager-polyfill
script adds this HTML to the page:With the embedded
<style>
element, the form is rendered so that password mangers still think it exists, but is invisible to humans.Input events are captured on the form, and the username and password fields on the page are updated to reflect whatever new content was inserted.
The form submit is also intercepted, and the "next" button is clicked when the form is submitted by the password manager.
When Chrome, browsers, and password managers fix this bug on their end, having two password fields might confuse password managers. I can't test because nobody has seemed to have fixed it yet, but I'd like to make this change future-proof.
I don't think this would cause issues, because if the password manager decides to fill out the existing HA fields and not the invisible ones, all the better. But I'm open to advice here.
Type of change
Additional information
Checklist
^ I should probably do this after most changes are approved