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

Missing credentials #26

Closed
mattbrun opened this issue Jan 30, 2015 · 5 comments · May be fixed by #27
Closed

Missing credentials #26

mattbrun opened this issue Jan 30, 2015 · 5 comments · May be fixed by #27

Comments

@mattbrun
Copy link
Contributor

Hi,
I found a strange behaviour when my login is autofill by the browser.

Basically when the page is loaded and the browser (firefox 35.0.1) fills the user and password for me.
If I click the Login button right away the "missing credentials" error is given to me.
On the server side I receive email and password as undefined.
I believe this is because the model didn't received the input by the user, so data[field] = this.model.get(field) in the base class returns undefined.

missing_credentials

The strange thing is that if I than remove both fields, start typing the user and select the one I want from the browser saved credentials dropdown, and the browser fills up the fields for me, then I can succesfully login - even though I didn't filled up the password at all, and I partially filled the email field.

To solve this behaviour I tried to get the field data directly from the dom, with somehting like data[field] = this.model.get(field) || this.dom.getElementById(field).value, but there's no such function, as I didn't find other functions which allows me to get a dom element refence from the dom object inside a component.

Any Idea? Is it happening only to me?

Thanks a lot!
Cheers

@agomat
Copy link

agomat commented Jan 30, 2015

Try to execute something like before submitting the form (for testing purpose):
$('form #username').change();
$('form #password').change();

@mattbrun
Copy link
Contributor Author

I resolved with document.getElementById(field + 'Input').value, of course adding id="emailInput" in the login component

@agomat
Copy link

agomat commented Jan 30, 2015

It looks like autofill should trigger a change event after filling the fields (its FF issue, Chrome should works). Since it does seem like derbyjs is watching for the change event.

@mattbrun
Copy link
Contributor Author

ok. at this point my solution is only a quick work around
we might resolve the issue at the root listening the right event for firefox in derby.

Btw, I saw a similar problem with another form (not in derby-login), where I have a select with several options.
If I don't click on the select (because the first choice is fine for instance), the selected option is not populated in the model - again using FF.
I found this that may help without modifying derby itself https://github.com/tbosch/autofill-event , but I don't have the time to try it right now.

@mattbrun
Copy link
Contributor Author

Solved by #27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants