Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why shouldn't usernames and passwords contain spaces?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Why shouldn't usernames and passwords contain spaces?
 
Possibly because of a bug in IIS dealing with spaces passed into the query string. However, you shouldn't be putting passwords into the query string anyway; you should set the form's method to POST so they don't show up in the user's URL bar.

Last time I designed a web site that needed authentication, that's the method I used, and there was no reason for me not to allow spaces in passwords.
 
All major sites and computers that require password authentication don't allow spaces in usernames or passwords.
Does anyone know why is it so?
 
so we (programmers) don't have to deal with getting rid of them trim wise etc...

If you really wanted to allow spaces you can but it's common practice not too [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
Why bother trimming the password? What's wrong if the user wants the password to start or end with a space?
 
Also, if you allow leading and trailing spaces it is easier for the user to make a mistake. You will end up having users register multiple times because they don't know their username and/or password.

For instance, if a user accidently entered their user name with a trailing space when they registered (abcd[space]), they might later wonder why their username of abcd with no space doesn't work.

 
because then they would be called passphrases and that would suck.

you come up with the best way to put things sometimes xutopia [thumbsup]
[bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
admin@onpntwebdesigns.com
 
I guess there are legacy reasons for that and also some psychological ones.

The cat is on the roof.

and

The cat is sitting on the roof top.

means almost the same but are very different it terms of bytes. Let's say your passphrase was a sentence and you forgot what grammar, syntax and exact words you phrased your sentence with, no matter how much you try you might never get it with the exact wording and you might get stuck.

Our brain doesn't remember a sentence as easily as a single word. Also a single word is always spelled the same whereas words bring another level of complexity due to punctuation and grammar. A word is simple. :)

Another reason why a password is a word and not a collection of words is that in the old days memory was expensive and the computer programmers could not afford to store huge amounts of data for a passphrase! :) often times passowrds were limited to less than 8 chars!! :) Gary Haran
 
What if a user forgets there password and you send it to them...

Your password is bob

how can you tell that there is spaces on either end? Then you would have to write more code to replace spaces with

(space)bob(space)

Its better not to..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top