Fri Jun 23 2017
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
function get_token()
{
  window.briteverifyToken = false;

  var form_token = '4047df1c-5078-4e96-b335-f61aa2b92891'; // public key
  var url = 'https://forms-api-v1.briteverify.com/api/submissions/view.json?callback=getBriteverifyToken&form_token='+form_token+'&_='+Date.now();

  // append script to body to get cross-domain jsonp data
  var script = document.createElement('script');
  script.src = url;
  document.body.appendChild(script);

  window.getBriteverifyToken = function(data)
  {

    window.briteverifyToken = data.token;
    delete window.getBriteverifyToken;
    document.body.removeChild(script);
  }
}



function verify_real_email(email,success,failure, lang, emailElement, cis_name)
{

  if(window.briteverifyToken)
  {


    var token = window.briteverifyToken;
    var url = 'https://forms-api-v1.briteverify.com/api/submissions/verify.json?callback=briteverify&form_token=4047df1c-5078-4e96-b335-f61aa2b92891&token='+token+'&email='+email+'&_='+Date.now();

    var script = document.createElement('script');
    script.src = url;
    document.body.appendChild(script);

    // if the script url doesn't work (maybe they changed the api)
    script.onerror = function(e)
    {
      // ignore verification and move on
      success(email, lang, cis_name);
    };
    
    window.briteverify = function(data)
    {
      try
      {

        if(data.status!=='invalid')
        {
          // email is valid
          success(email, lang, cis_name);
        }
        else
        {
          // email is invalid
          failure(emailElement);
        }

        document.body.removeChild(script);
      }
      catch(e)
      {
        // if error, ignore verification and move on
        success(email, lang, cis_name);
      }
      delete window.briteverify;
    }
  }
  else
  {
    // if no token, ignore verification and move on
    success(email, lang);
  }
}



function emailAccepted(email, lang)
{
   // bright verify accepted email. send to ec
}


function emailRejected(emailElement)
{
  // bright verify didnt accept email
}