Closed cleversprocket closed 10 years ago
This was to prevent URL's to be registered as usernames. In the example app which is hosted on Heroku, I display a list of usernames in the user list view. I didn't want spammers entering URL's as usernames, and then having them be visible on this page: http://angular-client-side-auth.herokuapp.com/admin/
In terms of actual applications derived from this project, there's no problem changing it to something less strict :)
Does it matter that example.com is valid with this regex? Thanks
I think it's okay if it's only domain names :) This measure was just to prevent/reduce the possibility of anyone linkbaiting on the demo site. In addition the users saved in memory on the server are reset at a set interval.
I'm terrible at understanding long regex and I was unable to enter a correct username with WebStorm's check regex feature. It's located in server/models/User.js:
validate: function(user) { ... check(user.username, 'Invalid username').not(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/); }
Thanks in advance!