r/programminghorror • u/throwawaykJQP7kiw5Fk [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" • Dec 22 '25
Javascript This site has a hardcoded check assuming your first name will always be two characters or more
Imagine being X Æ A-Xii Musk and trying to use this site, couldn't be me
176
Upvotes
84
u/repeating_bears Dec 22 '25
Christ, what a mess
My favourite is the various prefixes and suffixes concatenated together that obscures what's being printed
43
u/KGBsurveillancevan Dec 22 '25
This is why yall can never make me hate regex
39
u/[deleted] Dec 22 '25
There’s a lot wrong with this, but
.parent().parent().parent().find(selector)🤢🤢
Could just be
.closest(selector)Also prevents breakage if markup changes and the selector is no longer 3 ancestors up.
44
u/East_Nefariousness75 Dec 22 '25
This article came to my mind: https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/
6
u/mss-cyclist Dec 22 '25
This whole piece of code is cringe af.
5
u/mothzilla Dec 22 '25
Found Xiaexii Musk's account.
5
u/archpawn Dec 22 '25
Fuck Yu in particular.
4
u/S4N7R0 Dec 22 '25
im not wellversed in js, assuming val = q.firstname.value and val is a string, are the three checks
val == undefined, andval == null, andval == ""really necessary instead of single one of them??4
u/parazoid77 Dec 23 '25
Part of my old companies' account setup asked you to set an answer to a secret question, with one being "what's your favourite colour?". It required the answer to be at least four characters, which gave me and my friend a proper chuckle. Apparently red is not acceptable as a favourite colour.
1
u/IbiXD Dec 22 '25
On AMD's website, to download Vitis and Vivado you need to fill a form with a field for city which accepts only 2 or more characters. There are cities all over Scandinavia with one letters only
Note: It accepted the name "--", which was also what I put in every other field as I didn't want to give them my info xd
2
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Dec 22 '25
I think there are a few horrors here.
1
u/[deleted] Dec 25 '25
I’ll take your word for it. 🤷♂️
1
u/Accomplished_Ant5895 Dec 26 '25
I ain’t reading allat
1
u/Psychological-Sand33 Dec 22 '25
Well, in that case, she can blame only her parents
1
u/TheChief275 Dec 22 '25 edited Dec 22 '25
Can a name even be as short as a single byte? I don’t think it can?
So I don’t see how that’s ridiculous, or is it a limit of two unicode characters?
1
u/shponglespore Dec 22 '25
Lots of Chinese people have a one-character first name. Almost all have a one-character surname.
-14
u/iEatedCoookies Dec 22 '25
Is it really bad programming to hardcore validation? Not really. Forcing 2 letters for a name is a bad idea, sure. But having validation isn’t horror.
-11
u/Vauland Dec 22 '25
Depends on the target customers I guess. In Europe there are not much people with names that got 3 chars and less. I mean, sure it's bad programming, but I think it gets the job done and 99% of people don't care aswell as the client who paid for it.