The iPad application I'm working on requires that the user provide a username and password that are authenticated against a server before they can enter the application proper. I'm considering making a subtle change so that whitespace at the start and end of the username and password are silently ignored.
Good idea? Bad idea? Reasons for your position?
This has come about after I demonstrated the product to a customer today and struggled to log in. After three attempts I finally realised that I'd somehow managed to put a space before my username, and of course, that didn't match any username on the server. There's a very, very subtle difference in width with an additional space at the start of a text field on the iPad, given that the field border is spaced away from the first character anyway, and it took me some time to notice.
You should not trim the password. If you do not want to accept passwords with spaces then a password containing spaces should not be accepted.
Absolutely! Using spaces in passwords is an excellent idea, because it significantly improves the security (strength) of your passwords. It helps to protect your accounts from attackers who might be trying to guess your passwords, crack them, or employ brute forcing in order to compromise your accounts.
Usernames typically don't contain spaces, so allowing users to type in an invalid input and silently removing the space is overly presumptuous for the UX. It's better to detect the interstitial space and inform the user (e.g. Usernames can't contain spaces ) so they can check the username again.
I think that it is a good practice to trim the whitespaces, since they are usually considered invalid username/password symbols (users can miss them very easily, especially if they use more than one).
NSString *trimmedString = [myString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With