From f99d42cf1bfb7eb0cf3b72da3c0b3c4dc7d7d5d0 Mon Sep 17 00:00:00 2001
From: John McLear <john@mclear.co.uk>
Date: Mon, 17 Mar 2014 19:01:03 +0000
Subject: [PATCH] validator changed its api, thanks guys....

---
 handleMessage.js | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/handleMessage.js b/handleMessage.js
index 358c5e7..bafcbb3 100644
--- a/handleMessage.js
+++ b/handleMessage.js
@@ -162,7 +162,6 @@ exports.handleMessage = function(hook_name, context, callback){
 exports.subscriptionEmail = function (context, email, emailFound, userInfo, padId, callback) {
   var validatesAsEmail = exports.checkEmailValidation(email);
   var subscribeId = randomString(25);
-
   if(emailFound == false && validatesAsEmail){
     // Subscription -> Go for it
     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
  */
 exports.checkEmailValidation = function (email) {
-  var Validator = require('validator').Validator;
-  var validator = new Validator();
-  validator.error = function() {
+  var validator = require('validator');
+  if(validator.isEmail(email)){
+    return true;
+  }else{
     return false;
-  };
-  return validator.check(email).isEmail();
+  }
 }
 
 /**