email validation using email-validator module
This commit is contained in:
parent
fce1d4d7aa
commit
f3a3e0ff10
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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…
Reference in New Issue