superlogin
superlogin copied to clipboard
Is it necessary to downcase username?
In our application we were allowing usernames with uppercase letters and then later new users were wondering why they couldn't log into their accounts. Is it necessary to downcase username?
var userModel = {
...
sanitize: {
name: ['trim'],
username: ['trim', 'toLowerCase'],
email: ['trim', 'toLowerCase']
},
I made this design decision because case sensitive usernames can create a lot of confusion. What I suggest is that you save all names as lower case in the database, and when a user submits a login form convert the username to lowercase before attempting login. That way no matter what case a user enters they will be able to login.
Passwords, on the other hand, are case sensitive for security reasons.