Reputation: 36632
I've noticed that on any login form, when I fail to enter the correct username/password combination, the browser (Chrome, at least) does not prompt me to save the password.
As soon as I enter the right credentials however, the popup appears and I am prompted to save it.
Is there any kind of web standard that governates this behaviour?
How can I be confident, when I build a web app, that the browser will understand when the credentials are right or wrong?
Note: this is not a duplicate of How does browser know when to prompt user to save password? as suggested: the problem there is that the prompt does not appear at all. I do not have this problem: the prompt does appear, but I'm surprised it appears only when the login is successful.
My question is how does the browser knows to only prompt it when the login is successful?
Upvotes: 3
Views: 892
Reputation: 577
The browser look for the UI & url change. If it's not the same page on which the login form appears, the browser do prompt the save password tool.
So definitely You should post the form to different url in case of correct credentials, and redraw the same login form if it fails.
Google even gives additional ways to get the behavior wanted:
1.Include autocomplete in the form.
2.Prevent the form from submitting.
3.Authenticate by sending a request.
4.Store the credential.
5.Update the UI or proceed to the personalized page.
Upvotes: 0