validator changed its api, thanks guys....
This commit is contained in:
parent
5ca7609a8b
commit
f99d42cf1b
1 changed files with 5 additions and 6 deletions
|
@ -162,7 +162,6 @@ exports.handleMessage = function(hook_name, context, callback){
|
||||||
exports.subscriptionEmail = function (context, email, emailFound, userInfo, padId, callback) {
|
exports.subscriptionEmail = function (context, email, emailFound, userInfo, padId, callback) {
|
||||||
var validatesAsEmail = exports.checkEmailValidation(email);
|
var validatesAsEmail = exports.checkEmailValidation(email);
|
||||||
var subscribeId = randomString(25);
|
var subscribeId = randomString(25);
|
||||||
|
|
||||||
if(emailFound == false && validatesAsEmail){
|
if(emailFound == false && validatesAsEmail){
|
||||||
// Subscription -> Go for it
|
// Subscription -> Go for it
|
||||||
console.debug ("Subscription: Wrote to the database and sent client a positive response ",context.message.data.userInfo.email);
|
console.debug ("Subscription: Wrote to the database and sent client a positive response ",context.message.data.userInfo.email);
|
||||||
|
@ -329,12 +328,12 @@ exports.sendUserInfo = function (context, emailFound, email, userInfo) {
|
||||||
* Function to check if an email is valid
|
* Function to check if an email is valid
|
||||||
*/
|
*/
|
||||||
exports.checkEmailValidation = function (email) {
|
exports.checkEmailValidation = function (email) {
|
||||||
var Validator = require('validator').Validator;
|
var validator = require('validator');
|
||||||
var validator = new Validator();
|
if(validator.isEmail(email)){
|
||||||
validator.error = function() {
|
return true;
|
||||||
|
}else{
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
return validator.check(email).isEmail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue