用户是否应该能够输入诸如12345"或12345"之类的密码——开头或结尾的空格?或者您是否会修剪密码以删除前导或尾随空格,因为它可能只是输入错误.
Should users be able to enter a password such as " 12345" or "12345 " – a space at the beginning or end? Or would you trim the password to remove the leading or trailing spaces because it may just a typing error.
是的,他们应该这样做.
Yes, they should.
当人们决定我的密码应该如何表现时,我感到非常恼火,尤其是当它是无意义的时候.我想要超过 8 个字符.您应该对密码进行哈希处理,因此末尾的最大字符长度和空格无关紧要.不,你不应该修剪它.
您需要用户输入两次密码(在创建密码时)以消除输入错误.因此,空格无关紧要.