Re: Do you trim() usernames and passwords?

From: Date: Tue, 28 Dec 2010 14:49:16 +0000
Subject: Re: Do you trim() usernames and passwords?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-310264@lists.php.net to get a copy of this message
On Tue, Dec 28, 2010 at 15:12, Ashley Sheridan <ash@ashleysheridan.co.uk> wrote: > The copy-paste thing I've noticed only really seems to happen on Windows, particularly > with Outlook. The thing I always tell people if > I'm emailing people a password is that they should type it out rather than copy paste to > avoid these issues. The whitespace usually > seems to consist of newlines and carriage returns, so you could try stripping those two > characters out specifically rather than a full > trim(). > I do trim newlines, carriage returns, null characters, vertical and regular tabs. However, the space is the problem. I don't think that telling them to type it out is a good solution as it is "fixing the user" which, although might be where the problem lies, is never the solution. > As you've said, a user might want a space in their password, and should be allowed to use > them. Maybe add a footnote to the > password field reminding people about accidental copied characters, and perhaps a Javascript > counter that displays the number of > characters used in the password field (as a lot of people know their password length but find > counting the password character in a > field difficult because the characters are all the same and the eyes can't follow easily) > I will add such a footnote in the event of a failed password attempt (right there with the capslock warning) but I do not think that a counter is a good method. -- Dotan Cohen http://gibberish.co.il http://what-is-what.com

« previous php.general (#310264) next »