Skip to content
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

Autofilled fields not accepted until modified "by hand" #31

Open
NathanRVance opened this issue Oct 7, 2020 · 4 comments
Open

Autofilled fields not accepted until modified "by hand" #31

NathanRVance opened this issue Oct 7, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@NathanRVance
Copy link

When autofilling, the form displays the errors "Please enter a username" and "Please enter a password". If I modify the field (e.g., type a space at the end and then delete it), then the values that were autofilled are accepted. I had similar problems when remembering passwords with epiphany (same okta implementation), so it may be a webkit issue. The okta server in question is http://okta.nd.edu. Is this fixable in openconnect-sso, or do I need to report upstream?

@vlaci
Copy link
Owner

vlaci commented Oct 8, 2020

I can see that happening as I not fill the form in the exact same way as a browser would: https://github.com/vlaci/openconnect-sso/blob/master/openconnect_sso/browser/webengine_process.py#L170

I am far from being a javascript expert but I can imagine that firing some additional event would fix the issue. It is no webkit issue as the browser actually chromium based. I peeked into how an actual browser plugin does form filling. Browserpass for example has some additional incantations: https://github.com/browserpass/browserpass-extension/blob/master/src/inject.js#L435
I am overwhelmed by work nowdays so can't promise a prompt fix.

@vlaci vlaci added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Oct 25, 2020
@nicolaerosia
Copy link

@vlaci thanks! I can confirm that using this update function makes it work with Okta

@pylight
Copy link

pylight commented Jan 11, 2024

@vlaci I can also verify that an additional event is needed for okta-based login screens. I tested that adding the change event is enough to make it work.

Just replace this statements.append call with the following:

statements.append(
    f"""var elem = document.querySelector({selector}); if (elem) {{ elem.dispatchEvent(new Event("focus")); elem.value = {value}; 
 
     // okta: additional event is needed, see issue #31
     elem.dispatchEvent(new Event("change", {{bubbles:true}}));
 
     elem.dispatchEvent(new Event("blur")); }}"""           
)
 

Could we change it like this in the repo?

@pylight
Copy link

pylight commented Jan 11, 2024

Additional note: also saw that pull request #142 contains similar tweaks in its first commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants