Henry
Henry

Reputation: 32885

Instruct browser to only prompt for saving username/password when they have logged in successfully?

I noticed that some site would trigger the browser to prompt for saving username/password Only when they have logged in successfully. How to achieve that? response with HTTP 401 / 403 on error along side with the login form with error message?

Right now when I try logging in with invalid username/password, the server will redirect the browser back to the login form with some error message that indicates to the user that the username/password is incorrect, but the browser would ask if the client want to save the username/password which is inappropriate.

Thank you.

Upvotes: 8

Views: 453

Answers (4)

SkaveRat
SkaveRat

Reputation: 2282

I think at least Chrome does a little URL and content checking to figure out if the login was successfull

Upvotes: 0

lmwood
lmwood

Reputation: 21

You could write some javascript to check if the credentials are correct, then if they are submit the form.

Double login but then the form would only be submitted if the credentials are correct.

Upvotes: 2

Gabriel Nahmias
Gabriel Nahmias

Reputation: 1

I would imagine you could use JavaScript with PHP to check if the user exists, has the right password entered, then JS would also be used to unhide a checkbox in the form or possibly and simply prompt them to save the login credentials. Let me know if that makes sense.

Now, I see you're asking whether you can disable the inherent browser inquiry in this case. As far as that goes, you could still follow part of my initial idea and then use browser-specific code to disable the question. I'll look into it.

Upvotes: 0

EricLaw
EricLaw

Reputation: 57075

As far as I know, there's no standard way of doing this, although the topic comes up from time to time.

Upvotes: 0

Related Questions