views:

418

answers:

2

On most sites on the register user part they want you to enter password 2 times. Why is that? Why not just one input where you enter password? Why do you have to "confirm" it.

You know

Username
Password
Confirm password

Submit

This has been on my mind for a while...

Hope somebody can answer this.

Thanks

+17  A: 

It is to avoid typos. If you have to type the password twice chances are you'll make your password what you want. They want to avoid having people whose password is "blah" having to retrieve their password later on because they typed "blaj" by mistake. This is especially true since password fields show as asterisks (*********) and sometimes it is hard to tell if you typed what you thought you typed - people are likely to make typos without even realizing it. Some websites do this too with the email address when it is essential that is correct as well.

By the way: I am not sure why PHP is mentioned at all, this has nothing to do with PHP and is used in all kinds of websites. :)

Paolo Bergantino
Agreed. Not related to programming, let alone PHP!
Cerebrus
Thank you for that good answer. And no this is of course not only for php. I guess i didnt think as usual hehe
I wonder what evidence there is that this actually works, and how one would go about collecting it.
Robert Rossney
+4  A: 

If you use an input element of the type password (that you should!) the entered text will not be shown. Instead every character is represented by a * or to at least get a feedback for the length.

So you cannot see if you spelled your password correctly. Therefor you are asked to enter your password twice and the application checks if both entered passwords are identical.
But this doesn’t prevent that both times the password is entered incorrectly.

Gumbo
Especially if the password is case-sensitive and you have caps lock turned on ;-)
Rauhotz
This is why it’s a good idea to use JavaScript to switch between password and plaintext or show a warning when Caps Lock is pressed (like Mac OS X does).
Gumbo