Should I trim spaces in a password field

后端 未结 8 689
南旧
南旧 2021-01-01 12:17

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

8条回答
  •  离开以前
    2021-01-01 12:38

    You can use this to alert user that password include spaces or something like that.

    if (/^\s|\s$/.test(password)) {
        //alert('Hey Watchout');
    }
    

    Triming password is not a good practice.

    Hope this helps.

提交回复
热议问题