Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Extra @ in valid email [R] [C-Chris]
MyBB doesn't accept 2 @ chars in an email, as it should. However, the AJAX check, marks it as valid (in other words, having two @ chars in an email marks the field green).

I tried an invalid email like so:
[email protected]

And it highlighted the email field green. However, having an email like so: [email protected] is invalid.

It's nothing major, but it pretty much defeats the purpose of the AJAX check validation for easy registration.
Best Regards.
The regexp seems to be ok...

Strange.... I'm not so good in js, so maybe someone else will be able to explain this:

open the firebug console and copy&paste the following:
regex1 = /^([a-zA-Z0-9_\.\+\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

regex2 = new RegExp('^([a-zA-Z0-9_\.\+\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$');

str = "[email protected]";

console.log("1: " + regex1.test(str))
console.log("2: " + regex2.test(str))
This will print:
Quote:1: false
2: true
Although, the regexes are the same.
Of course as you can understand MyBB using the second method ("new RegExp")
Creativity is a drug I cannot live without.
[Image: 1]Support PM will be ignored
Shouldn't this:


Be this:

That will make it strict and it should work.
oh... it has nothing to do with the regexes, nor nothing special to javascript... it's the slashes!
in the first method ( /theregex/ ), the slashes are part of the regex, they're used to escape literal chars into the regex
in the second method ( new RegExp('theregex') ), the slashes between the apostrophes are used to escape special chars into the string like '\r\n\t'

while using the second method every slash should be doubled so the first one used to escape the second into the string and the second slash will escape the literal char into the regex

In the ACP open the template 'member_register', scroll down and find the following line:
	regValidator.register('email', 'regexp', {match_field:'email2', regexp:'^([a-zA-Z0-9_\.\+\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$', failure_message:'{$lang->js_validator_invalid_email}'});
replace it with the line:
	regValidator.register('email', 'regexp', {match_field:'email2', regexp:'^([a-zA-Z0-9_\\.\\+\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$', failure_message:'{$lang->js_validator_invalid_email}'});

Can someone just validate this again?

Also someone should search any other place in MyBB that this problem might occur again
Creativity is a drug I cannot live without.
[Image: 1]Support PM will be ignored
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group
Creativity is a drug I cannot live without.
[Image: 1]Support PM will be ignored
Solution is confirmed to work. All what's left is to have a developer update the revision, then I'll confirm the thread.

Forum Jump:

Users browsing this thread: 1 Guest(s)