Re: Do you trim() usernames and passwords?

From: Date: Tue, 28 Dec 2010 13:27:29 +0000
Subject: Re: Do you trim() usernames and passwords?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-310263@lists.php.net to get a copy of this message
On 12/28/2010 7:49 AM, Dotan Cohen wrote:
I seem to have an issue with users who copy-paste their usernames and passwords coping and pasting leading and trailing space characters. The obvious fix was to trim() the values that I receive, but I worry how that would affect users who use a space at the beginning or end of their password. Of course, if I trim() also when the user is setting his password then he will never know that his password is really 1 digit shorter, but do I really want to do that? Thoughts? Thanks!
Can't you simply specify the allowed characters that can be used for PWs and usernames? I always do, e.g., 6-8, case sensitive, alphanumerics, and the following characters: "@, #, $, %, &, *, -". Then, I trim() and check the submitted PW for any exceptions to the rules.

« previous php.general (#310263) next »