diff --git a/resources/static/dialog/resources/validation.js b/resources/static/dialog/resources/validation.js index 15b98c1b7a6bf3b1837f97f8cec72ec541bb4dea..e1f6564538ec053ce39665d86680ec99c2cd2b1a 100644 --- a/resources/static/dialog/resources/validation.js +++ b/resources/static/dialog/resources/validation.js @@ -38,12 +38,13 @@ BrowserID.Validation = (function() { tooltip = bid.Tooltip; bid.verifyEmail = function(address) { - // gotten from http://blog.gerv.net/2011/05/html5_email_address_regexp/ + // Original gotten from http://blog.gerv.net/2011/05/html5_email_address_regexp/ // changed the requirement that there must be a ldh-str because BrowserID - // is only used on internet based networks. + // is only used on internet based networks. Also modified to allow capital + // letters in the domain name. var parts = address.split("@"); - return /^[\w.!#$%&'*+\-/=?\^`{|}~]+@[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(address) + return /^[\w.!#$%&'*+\-/=?\^`{|}~]+@[a-zA-Z\d-]+(\.[a-zA-Z\d-]+)+$/.test(address) // total address allwed to be 254 bytes long && address.length <= 254 // local side only allowed to be 64 bytes long diff --git a/resources/static/dialog/test/qunit/resources/validation_unit_test.js b/resources/static/dialog/test/qunit/resources/validation_unit_test.js index 37925f8174bb184647f14f600f12e729707fe60c..7b7c532a331a55f06f09522d5a9d07dbc098a463 100644 --- a/resources/static/dialog/test/qunit/resources/validation_unit_test.js +++ b/resources/static/dialog/test/qunit/resources/validation_unit_test.js @@ -112,8 +112,15 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/browserid", fu test("email with Capital Letters in domain side", function() { var valid = validation.email("x@Y.z"); - equal(valid, false, "capital letters not allowed in domain side"); - equal(tooltipShown, true, "missing email shows no tooltip"); + equal(valid, true, "capital letters are allowed in domain side"); + equal(tooltipShown, false, "capital letters in domain side causes no tooltip"); + }); + + test("email with numbers in domain side", function() { + var valid = validation.email("x@0.Z"); + + equal(valid, true, "numbers are allowed in domain side"); + equal(tooltipShown, false, "numbers in domain side causes no tooltip"); });