Browse Source

email validation using email-validator module

activeAddress
Ivan Socolsky 10 years ago
parent
commit
f3a3e0ff10
  1. 3
      lib/server.js
  2. 1
      package.json

3
lib/server.js

@ -5,6 +5,7 @@ var async = require('async');
var log = require('npmlog');
log.debug = log.verbose;
log.disableColor();
var EmailValidator = require('email-validator');
var WalletUtils = require('bitcore-wallet-utils');
var Bitcore = WalletUtils.Bitcore;
@ -449,7 +450,7 @@ WalletService.prototype.savePreferences = function(opts, cb) {
opts = opts || {};
if (opts.email) {
if (opts.email.length > 254 || opts.email.indexOf('@') == -1) {
if (!EmailValidator.validate(opts.email)) {
return cb(new ClientError('Invalid email address'));
}
}

1
package.json

@ -24,6 +24,7 @@
"bitcore-wallet-utils": "0.0.12",
"body-parser": "^1.11.0",
"coveralls": "^2.11.2",
"email-validator": "^1.0.1",
"express": "^4.10.0",
"inherits": "^2.0.1",
"locker": "^0.1.0",

Loading…
Cancel
Save