Open NathanRVance opened 4 years ago
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 thanks! I can confirm that using this update function makes it work with Okta
@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?
Additional note: also saw that pull request https://github.com/vlaci/openconnect-sso/pull/142 contains similar tweaks in its first commit.
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?