I'm having a pretty annoying problem with this Save Password option browsers often offer.
I'm using AngularJS in a login form. The user fills in the email and password normally and the request is sent via Ajax to check if it is authenticated or not. So far so good.
The problem occurs when this Save the password option appears.
After the user has saved the password, when trying to login again, the normal one is to appear the filled data, with a yellow horrible in the input.
The problem is that these prepended values do not go to the $scope.usuario
variable I created.
More or less like this:
<form name="form">
<input ng-model="usuario.email" type="email" required>
<input ng-model="usuario.password" type="password" required>
<button type="submit" ng-disabled="form.$invalid">
</form>
In my case, I left AngularJS validating whether the form is valid or not to enable the login button.
When the values are filled, in Google Chrome in Ubuntu and Windows, which is where I did the tests on my machine, the button is still disabled, as if nothing was filled (which in this case would be considered invalid by the angular, since the fields are required
).
Example:
Butbyclickingonthepageoronthebutton,thevaluesare"really inserted" into the email and password inputs, making everything standardized and the login form works as expected.
In the image below, different from the previous one, after clicking on the body of the page, the value goes to AngularJS
TheproblemisthatinIPADProandMAC(GoogleChrome),thevalueofemailandpasswordaresimplynotrecognized.
Evenifyouclickonthebutton,orclickonanyoftheinputs,thebuttoncontinuesdisabled
.
Whiletesting,InoticedthatthevaluesautomaticallypopulatedbySaveChromePasswordaresimplynotpopulatedforinput.
WhenItrytoaccessvalue
ofinput[name=email]
forexample,throughdocument.querySelector
,thevaluereturnedis""
(empty string). The same thing is for the password field.
And the problem with this is that if the user deletes a letter and types again, the form "recognizes" the values and then they are recognized in both AngularJS and document.querySelector
.
body
.
But in IOS and MAC, none of this works.
- Is this some kind of Google Chrome BUG?
- Can you solve this?
Note: I have been asked to change the AngularJS login to a common form request, but this does not solve the problem,