Should I trim spaces in a password field

Liam picture Liam · Aug 30, 2011 · Viewed 11.8k times · Source

Just wondering.

We usually trim a user name in various forms in our ASP.Net application, whats the best practices for password fields.

i.e. should we remove a trailing space in a password field before being saved/encrypted?

Answer

onof picture onof · Aug 30, 2011

Leave the password as the user entered it.

You should never change silently a field put by a user, overall a password.