Skip to content

Commit

Permalink
fix(EmailValidation): ignore case +match whole str (Availity#60) (Ava…
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSharpieOne authored Jan 23, 2018
1 parent 6020830 commit b5c7539
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions __test__/AvValidator.email.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('Email Validation', () => {
expect(fn('[email protected]')).to.be.true;
expect(fn('[email protected]')).to.be.true;
expect(fn('[email protected]')).to.be.true;
expect(fn('[email protected]')).to.be.true;
});

it('should return false for an invalid email', () => {
Expand All @@ -21,5 +22,6 @@ describe('Email Validation', () => {
expect(fn('[email protected]')).to.be.false;
expect(fn('evan.sharp')).to.be.false;
expect(fn('availity.com')).to.be.false;
expect(fn('Evan@[email protected]')).to.be.false;
});
});
2 changes: 1 addition & 1 deletion src/AvValidator/email.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import patternValidation from './pattern';

const EMAIL_REGEXP = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;
const EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i;

export default function validate(value, context, { pattern = EMAIL_REGEXP, errorMessage = false } = {}) {
return patternValidation(value, context, { value: pattern, errorMessage });
Expand Down

0 comments on commit b5c7539

Please sign in to comment.