Added underscores and dashes to usernames

This commit is contained in:
rainbow napkin 2025-05-02 03:47:46 -04:00
parent 23ceb74883
commit d3aa4b8274
3 changed files with 17 additions and 5 deletions

View file

@ -25,9 +25,19 @@ module.exports.user = function(field = 'user'){
[field]: {
escape: true,
trim: true,
isAlphanumeric: {
errorMessage: "Usernames must be alphanumeric."
//Caution: Nerd Rant
//isAlphanumerics only takes locale for the option flag in schemas for some reason...
matches: {
//See this is the shit I'm talking about, WHY IS THIS CALLED OPTIONS? IT SHOULD BE PATTERN
//OPTIONS IS SUPPOSED TO BE AN OBJECT THAT PASSES EXTRA VALUES THATS LITERALLY HOW EVERYTHING ELSE IN THIS FUCKING LIBRARY WORKS
//WHO FUCKING WROTE THIS SHIT!?!?!?!?!
//HOW IS THIS ACCEPTED ON ONE OF THE MOST WIDELY USED VALIDATION LIBRARIES ON THE WEB!??!?!?!!?
//IT'S NOT EVEN FUCKING DOCUMENTED ANYWHERE!!!!!!!!!!!!
//WEBDEVS, GET YOUR FUCKING SHIT TOGETHER, FUCK!
options: [/^[A-Za-z0-9-_]+$/],
errorMessage: "Usernames can only contain numbers, letters, underscores, and dashes."
},
//matches: /^[A-Za-z0-9-_]+$/,
isLength: {
options: {
min: 1,