How to use email-validator - 10 common examples

To help you get started, we’ve selected a few email-validator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeit / now / lib / login.js View on Github external
async function register(url, { retryEmail = false } = {}) {
  let email
  try {
    email = await readEmail({ invalid: retryEmail })
  } catch (err) {
    process.stdout.write('\n')
    throw err
  }

  process.stdout.write('\n')

  if (!validate(email)) {
    return register(url, { retryEmail: true })
  }

  const { token, securityCode } = await getVerificationData(url, email)
  console.log(
    `> Please follow the link sent to ${chalk.bold(email)} to log in.`
  )

  if (securityCode) {
    console.log(
      `> Verify that the provided security code in the email matches ${chalk.cyan(
        chalk.bold(securityCode)
      )}.`
    )
  }
github Automattic / wp-calypso / client / extensions / woocommerce / app / order / order-customer / dialog.js View on Github external
validateEmail = event => {
		const { translate } = this.props;
		if ( ! emailValidator.validate( event.target.value ) ) {
			this.setState( {
				emailValidMessage: translate( 'Please enter a valid email address.' ),
			} );
		} else {
			this.setState( {
				emailValidMessage: false,
			} );
		}
	};
github orbiting / crowdfunding-frontend / components / Pledge / Form.js View on Github external
handleEmail (value, shouldValidate, t) {
    this.setState(FieldSet.utils.mergeField({
      field: 'email',
      value,
      error: (
        (value.trim().length <= 0 && t('pledge/contact/email/error/empty')) ||
        (!isEmail(value) && t('pledge/contact/email/error/invalid'))
      ),
      dirty: shouldValidate
    }))
  }
  checkUserFields (props) {
github Automattic / vip-go-mu-plugins-built / jetpack / extensions / blocks / simple-payments / edit.js View on Github external
validateEmail = () => {
		const { email } = this.props.attributes;
		if ( ! email ) {
			this.setState( {
				fieldEmailError: __(
					'We want to make sure payments reach you, so please add an email address.',
					'jetpack'
				),
			} );
			return false;
		}

		if ( ! emailValidator.validate( email ) ) {
			this.setState( {
				fieldEmailError: sprintf( __( '%s is not a valid email address.', 'jetpack' ), email ),
			} );
			return false;
		}

		if ( this.state.fieldEmailError ) {
			this.setState( { fieldEmailError: null } );
		}

		return true;
	};
github leonardowf / leonardo-vs-react / 07-redux-call-api-implementation / src / views / LoginView / LoginTabForm.js View on Github external
const validate = (values) => {
  const errors = {}

  if (!values.email || values.email.length === 0) {
    errors.email = 'Digite um email :('
  }

  if (values.email && !validator.validate(values.email)) {
    errors.email = 'Digite um email válido :('
  }

  if (!values.password) {
    errors.password = 'Digite uma senha :('
  }

  if (values.password && values.password.length < 6) {
    errors.password = 'A senha não pode ser menor do que 6 caracteres :('
  }

  return errors
}
github Automattic / wp-calypso / client / me / security-account-recovery / edit-email.jsx View on Github external
const email = this.state.email;

		if ( ! this.isSavable() ) {
			return;
		}

		if ( this.props.primaryEmail && email === this.props.primaryEmail ) {
			this.setState( {
				validation: this.props.translate(
					'You have entered your primary email address. Please enter a different email address.'
				),
			} );
			return;
		}

		if ( ! emailValidator.validate( email ) ) {
			this.setState( {
				validation: this.props.translate( 'Please enter a valid email address.' ),
			} );
			return;
		}

		this.setState( { validation: null } );
		this.props.onSave( email );
	};
github akshitgrover / hacken / User / userModel.js View on Github external
			validator: (value) => validate(value),
			message:"Email Is Invalid"
github Automattic / wp-calypso / client / blocks / signup-form / passwordless.jsx View on Github external
onInputChange = ( { target: { value } } ) =>
		this.setState( {
			email: value,
			errorMessages: null,
			isEmailAddressValid: emailValidator.validate( value ),
		} );

email-validator

Provides a fast, pretty robust e-mail validator. Only checks form, not function.

Unlicense
Latest version published 6 years ago

Package Health Score

71 / 100
Full package analysis

Popular email-validator functions