Browse Source

less strict email validation (ditch support for hostnames)

master
Guillermo Rauch 9 years ago
parent
commit
d29be302f3
  1. 6
      lib/login.js
  2. 2
      package.json

6
lib/login.js

@ -2,9 +2,7 @@ import chalk from 'chalk';
import fetch from 'node-fetch';
import * as cfg from './cfg';
import { stringify as stringifyQuery } from 'querystring';
import _emailRegex from 'email-regex';
const emailRegex = _emailRegex({ exact: true });
import { validate } from 'email-validator';
function readEmail ({ invalid = false } = {}) {
return new Promise((resolve, reject) => {
@ -61,7 +59,7 @@ function sleep (ms) {
async function register (url, { retryEmail = false } = {}) {
const email = await readEmail({ invalid: retryEmail });
if (!emailRegex.test(email)) return register(url, { retryEmail: true });
if (!validate(email)) return register(url, { retryEmail: true });
const verificationToken = await getVerificationToken(url, email);

2
package.json

@ -32,7 +32,7 @@
"split-array": "1.0.1",
"text-table": "0.2.0",
"spdy": "3.3.3",
"email-regex": "1.0.0"
"email-validator": "1.0.4"
},
"devDependencies": {
"alpha-sort": "1.0.2",

Loading…
Cancel
Save