How to use the isemail.validate function in isemail

To help you get started, we’ve selected a few isemail 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 strongloop / loopback4-example-shopping / packages / shopping / src / services / validator.ts View on Github external
export function validateCredentials(credentials: Credentials) {
  // Validate Email
  if (!isemail.validate(credentials.email)) {
    throw new HttpErrors.UnprocessableEntity('invalid email');
  }

  // Validate Password Length
  if (!credentials.password || credentials.password.length < 8) {
    throw new HttpErrors.UnprocessableEntity(
      'password must be minimum 8 characters',
    );
  }
}
github SastraNababan / graphql-workshop / 4.1-data-sources-db-finish / index.js View on Github external
context: ({ req }) => {
    // simple auth check on every request
    const auth = (req.headers && req.headers.authorization) || '';
    const email = new Buffer(auth, 'base64').toString('ascii');
    return { user: isEmail.validate(email) ? email : null };
  },
  dataSources : () => ({
github mobxjs / mst-gql / examples / 4-apollo-tutorial / server / src / index.js View on Github external
const context = async ({ req }) => {
  // simple auth check on every request
  const auth = (req.headers && req.headers.authorization) || ""
  const email = new Buffer(auth, "base64").toString("ascii")

  // if the email isn't formatted validly, return null for user
  if (!isEmail.validate(email)) return { user: null }
  // find a user by their email
  const users = await store.users.findOrCreate({ where: { email } })
  const user = users && users[0] ? users[0] : null

  return { user: { ...user.dataValues } }
}
github mystorp / http-mock-middleware / MagicNameMatcher.js View on Github external
exports.match = function(name){
    if(isUUID.anyNonNil(name)) {
        return "[uuid]";
    } else if(isNumber(name)) {
        return "[number]";
    } else if(dateRe.test(name)) {
        return "[date]";
    } else if(timeRe.test(name)) {
        return "[time]";
    } else if(isIP(name)) {
        return "[ip]";
    } else if(isemail.validate(name)) {
        return "[email]";
    }
    return name;
};
github Mailtrain-org / mailtrain / lib / tools-async.js View on Github external
const result = await new Promise(resolve => {
        const result = isemail.validate(address, {
            checkDNS: true,
            errorLevel: 1
        }, resolve);
    });
github aerobatic / aerobatic-cli / commands / register.js View on Github external
validate: value => {
        if (!isEmail.validate(value)) return 'Please enter a valid email';
        return true;
      }
    }, {
github FormidableLabs / gql-workshop-app / server / src / types / mutation.js View on Github external
login: (_, { email }) => {
      if (!isemail.validate(email)) {
        throw new GraphQLError('Invalid email address');
      }
      return {
        token: Buffer.from(email).toString('base64')
      };
    },
github SayMoreX / saymore-x / app / components / registration / RegistrationDialog.tsx View on Github external
private update(stateChanges: any) {
    const email = stateChanges.email || this.state.email;
    const howUsing = stateChanges.howUsing || this.state.howUsing;
    const validEmail = isEmail.validate(email, {
      minDomainAtoms: 2
    });
    this.setState({
      ...stateChanges,
      validEmail,
      acceptable: howUsing !== "" && validEmail
    });
  }
}
github JustComments / newsletter-cli / src / lib / commands / SendCommand.ts View on Github external
private validateSource() {
    if (!ismail.validate(this.source)) {
      throw new Error(`Sender's email address "${this.source}: is not valid`);
    }
  }
github parris / iz / src / basicValidators / email.js View on Github external
module.exports =function izEmail(value) {
  if (typeof value !== 'string') {
    return false;
  }
  return isEmail.validate(value, { errorLevel: false, minDomainAtoms: 2 });
};

isemail

Validate an email address according to RFCs 5321, 5322, and others

BSD-3-Clause
Latest version published 6 years ago

Package Health Score

58 / 100
Full package analysis

Popular isemail functions