Permalink
Browse files

fix(validation): accept emails containing an apostrophe on the front-end

  • Loading branch information...
philbooth committed Nov 21, 2018
1 parent f2b4b56 commit 07371075dbd70dc3fc3d99753aa9b1d6af676610
Showing with 9 additions and 1 deletion.
  1. +1 −1 app/scripts/lib/validate.js
  2. +8 −0 app/tests/spec/lib/validate.js
@@ -41,7 +41,7 @@ const unblockCodeRegExp = new RegExp(unblockCodeRegExpStr, 'i');
// * http://tools.ietf.org/html/rfc5321#section-4.5.3.1.1
// '/' in the character class is (redundantly) backslash-escaped to produce
// the same minimized form in node 4.x and node 0.10.
const emailRegex = /^[\w.!#$%&*+\/=?^`{|}~-]{1,64}@[a-z\d](?:[a-z\d-]{0,253}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,253}[a-z\d])?)+$/i;
const emailRegex = /^[\w.!#$%&'*+\/=?^`{|}~-]{1,64}@[a-z\d](?:[a-z\d-]{0,253}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,253}[a-z\d])?)+$/i;


// TOTP codes are 6 digits
@@ -75,6 +75,14 @@ describe('lib/validate', function () {
assert.isFalse(Validate.isEmailValid(email), email + ' should not be valid');
});
});

it('returns true if email address contains an apostrophe', function () {
assert.isTrue(Validate.isEmailValid('a\'b@example.com'));
});

it('returns false if email address contains a single quote', function () {
assert.isFalse(Validate.isEmailValid('a’b@example.com'));
});
});

describe('isTokenValid', function () {

0 comments on commit 0737107

Please sign in to comment.