Bug Reports
Posted: Tue Jun 25, 2013 7:55 pm
As a developer, there's nothing I hate more than bug reports consisting of "I opened it, clicked stuff, and an error popped up. Please fix ASAP." So when I stumbled across a bug on the League of Legends website, I wrote them the message that follows. How long do you think it will take them to fix it?
Moral of the story: Every programmer should be at least moderately proficient with Regular Expressions.I wrote:Attn: LeagueOfLegends.com Web Development Team
I have discovered a bug in the JavaScript-based password validator on the sign-up page.
Page: https://signup.leagueoflegends.com/en/signup/index
See: var validationRules
Notice the following rule:
{"rule":["custom","\/(\\d[a-z]|[a-z]\\d)\/i"],"message":"Must contain at least one letter and one number"},
The regular expression, unescaped for readability, "(\d[a-z]|[a-z]\d)" does not properly match all passwords containing at least one letter and one number. Rather, it matches passwords containing at least one adjacent letter/number pair.
Consider the following (theoretically valid) passwords:
Password123 [Passes]
123Password [Passes]
Password123- [Passes]
-123Password [Passes]
Password-123 [Fails]
123-Password [Fails]
The latter two are not matched by this regular expression, even though they are both perfectly based solely on the rules displayed to the user.
I propose the check be split into two rules to most simply resolve this issue:
\d
[a-z]
Those would be implemented as such:
{"rule":["custom","\/\\d\/i"],"message":"Must contain at least one number"},
{"rule":["custom","\/[a-z]\/i"],"message":"Must contain at least one letter"},
Note to developer: You may find http://regexpal.com/ incredibly useful for helping you test and debug regular expressions. Disclaimer: I do not own nor am I associated with the aforementioned site or it's owner.
I believe this issue may exist on other login pages, but I leave the responsibility of finding all instances of this bug to you.
I respectfully request that you contact me at the email provided when this issue has been resolved.
An avid League player,
Dan Washere