Re: Re: Do you trim() usernames and passwords?

From: Date: Tue, 28 Dec 2010 20:26:42 +0000
Subject: Re: Re: Do you trim() usernames and passwords?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-310287@lists.php.net to get a copy of this message
On Dec 28, 2010, at 3:23 PM, Dotan Cohen wrote: > On Tue, Dec 28, 2010 at 22:02, Joshua Kehn <josh.kehn@gmail.com> wrote: >> Trim usernames but not passwords. >> Some people put spaces at the beginning and end of their passwords. Double >> confirm and don't mess with the input otherwise they tend to get confused. >> > > How about: > > if ($trimmedUsername != $username){ > trim($password); > } > > I suppose that it is reasonable to assume (ha!) that if one was > copy-pasted with spaces, so would the other. Naive, I know, too bad I > don't dare start logging raw data to determine how true this might or > might not be. Educate the users, don't compromise the system. Either go full on and trim everything (I don't recommend this) or trim nothing. Be consistent in which one you pick. Regards, -Josh ____________________________________ Joshua Kehn | Josh.Kehn@gmail.com http://joshuakehn.com

« previous php.general (#310287) next »