use email-validator library, not isemail

This commit is contained in:
Ben Wheeler 2019-08-06 20:22:58 -04:00
parent ae706ddb91
commit 3a299cf810
3 changed files with 10 additions and 9 deletions

12
package-lock.json generated
View file

@ -4500,6 +4500,12 @@
"minimalistic-crypto-utils": "^1.0.0"
}
},
"email-validator": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/email-validator/-/email-validator-2.0.4.tgz",
"integrity": "sha512-gYCwo7kh5S3IDyZPLZf6hSS0MnZT8QmJFqYvbqlDZSbwdZlY6QZWxJ4i/6UhITOJ4XzyI647Bm2MXKCLqnJ4nQ==",
"dev": true
},
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
@ -7985,12 +7991,6 @@
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"isemail": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/isemail/-/isemail-2.2.1.tgz",
"integrity": "sha1-A1PT2aYpUQgMJiwqoKQrjqjp4qY=",
"dev": true
},
"isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",

View file

@ -72,6 +72,7 @@
"copy-webpack-plugin": "0.2.0",
"create-react-class": "15.6.2",
"css-loader": "0.23.1",
"email-validator": "2.0.4",
"enzyme": "3.10.0",
"enzyme-adapter-react-16": "1.14.0",
"eslint": "5.16.0",
@ -89,7 +90,6 @@
"glob": "5.0.15",
"google-libphonenumber": "3.2.3",
"html-webpack-plugin": "2.22.0",
"isemail": "2.2.1",
"iso-3166-2": "0.4.0",
"jest": "^23.6.0",
"json-loader": "0.5.2",

View file

@ -4,7 +4,7 @@ const React = require('react');
const PropTypes = require('prop-types');
import {Formik} from 'formik';
const {injectIntl, intlShape} = require('react-intl');
const isEmail = require('isemail');
const emailValidator = require('email-validator');
const JoinFlowStep = require('./join-flow-step.jsx');
const FormikInput = require('../../components/formik-forms/formik-input.jsx');
@ -22,7 +22,7 @@ class EmailStep extends React.Component {
}
validateEmailIfPresent (email) {
if (!email) return null; // skip validation if email is blank; null indicates valid
const localResult = isEmail.validate(email);
const localResult = emailValidator.validate(email);
if (localResult) {
return null; // TODO: validate email address remotely
}
@ -88,4 +88,5 @@ EmailStep.propTypes = {
onNextStep: PropTypes.func
};
module.exports = injectIntl(EmailStep);