Created
June 10, 2017 14:08
-
-
Save iamtracy/5f64d53890b8bf2400519f57ca022247 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
document.addEventListener('DOMContentLoaded', login); | |
function login() { | |
var oElem = document.getElementById('ItemList'); | |
var oLoginDiv = document.createElement('div'); | |
oLoginDiv.style.marginBottom = '20px'; | |
var oLoginLink = document.createElement('a'); | |
var showKey = GetURLParamValue("ShowKey"); | |
oLoginLink.innerHTML = '<p style="margin-top: 15px; margin-left: 5px;">Already Registered? Login Here!</p>'; | |
oLoginLink.style.color = '#333333'; | |
oLoginLink.href = 'https://vts.inxpo.com/scripts/Server.nxp?LASCmd=L:0&AI=1&InitialDisplay=1&ClientBrowser=0&ShowKey=' + showKey; | |
oLoginDiv.appendChild(oLoginLink); | |
function insertAfter(newNode, referenceNode) { | |
referenceNode.parentNode.insertBefore(newNode, referenceNode); | |
} | |
insertAfter(oLoginLink, oElem); | |
} | |
//<div style="color: #fff; font-weight: 300; margin-top: .75rem;" id="response"></div> | |
//.includes() polyfill for IE support | |
if (!String.prototype.includes) { | |
String.prototype.includes = function() { | |
'use strict'; | |
return String.prototype.indexOf.apply(this, arguments) !== -1; | |
}; | |
}; | |
var aBlockList = [ | |
/* Default domains included */ | |
"aol.com", "att.net", "comcast.net", "facebook.com", "gmail.com", "gmx.com", "googlemail.com", | |
"google.com", "hotmail.com", "hotmail.co.uk", "mac.com", "me.com", "mail.com", "msn.com", | |
"live.com", "sbcglobal.net", "verizon.net", "yahoo.com", "yahoo.co.uk", | |
/* Other global domains */ | |
"email.com", "games.com" /* AOL */ , "gmx.net", "hush.com", "hushmail.com", "icloud.com", "inbox.com", | |
"lavabit.com", "love.com" /* AOL */ , "outlook.com", "pobox.com", "rocketmail.com" /* Yahoo */ , | |
"safe-mail.net", "wow.com" /* AOL */ , "ygm.com" /* AOL */ , "ymail.com" | |
/* Yahoo */ | |
, "zoho.com", "fastmail.fm", "yandex.com", | |
/* United States ISP domains */ | |
"bellsouth.net", "charter.net", "comcast.net", "cox.net", "earthlink.net", "juno.com", | |
/* British ISP domains */ | |
"btinternet.com", "virginmedia.com", "blueyonder.co.uk", "freeserve.co.uk", "live.co.uk", | |
"ntlworld.com", "o2.co.uk", "orange.net", "sky.com", "talktalk.co.uk", "tiscali.co.uk", | |
"virgin.net", "wanadoo.co.uk", "bt.com", | |
/* Domains used in Asia */ | |
"sina.com", "qq.com", "naver.com", "hanmail.net", "daum.net", "nate.com", "yahoo.co.jp", | |
"yahoo.co.kr", "yahoo.co.id", "yahoo.co.in", "yahoo.com.sg", "yahoo.com.ph", | |
/* French ISP domains */ | |
"hotmail.fr", "live.fr", "laposte.net", "yahoo.fr", "wanadoo.fr", "orange.fr", | |
"gmx.fr", "sfr.fr", "neuf.fr", "free.fr", | |
/* German ISP domains */ | |
"gmx.de", "hotmail.de", "live.de", "online.de", "t-online.de" /* T-Mobile */ , "web.de", "yahoo.de", | |
/* Russian ISP domains */ | |
"mail.ru", "rambler.ru", "yandex.ru", "ya.ru", "list.ru", | |
/* Belgian ISP domains */ | |
"hotmail.be", "live.be", "skynet.be", "voo.be", "tvcablenet.be", "telenet.be", | |
/* Argentinian ISP domains */ | |
"hotmail.com.ar", "live.com.ar", "yahoo.com.ar", "fibertel.com.ar", "speedy.com.ar", "arnet.com.ar", | |
/* Domains used in Mexico */ | |
"hotmail.com", "gmail.com", "yahoo.com.mx", "live.com.mx", "yahoo.com", | |
"hotmail.es", "live.com", "hotmail.com.mx", "prodigy.net.mx", "msn.com" | |
]; | |
var aCompetitorBlockList = [ | |
"Ibm.com", "Tibco.com", "Mulesoft.com", "Ca.com", "Softwareag.com", "Seeburger.com", | |
"Talend.com", "Informatica.com", "Akana.com", "3scale.com", "Apigee.com", "Opentext.com", | |
"Snaplogic.com", "Layer7.com", "Gxs.com", "Liaison.com", "Okta.com", "Coviscnt.com", | |
"Mashery.com", "Google.com", "Cloud-elements.com", "Boomi.com", "Sap.com", | |
"Apiary.com", "WSO2.com", "Digitalml.com", "Mashape.com", "Sensedia.com" | |
]; | |
var aPersonalCompetitorBlockList = []; | |
for (var i = 0; i < aBlockList.length; i++) { | |
aPersonalCompetitorBlockList.push(aBlockList[i].toUpperCase()); | |
}; | |
var aCapitalCompetitorBlockList = []; | |
for (var i = 0; i < aCompetitorBlockList.length; i++) { | |
aCapitalCompetitorBlockList.push(aCompetitorBlockList[i].toUpperCase()); | |
}; | |
g_fnCustomValidationFcn = ValidateDomain; | |
function ValidateDomain() { | |
var cErrorMsg1 = 'Registration requires a valid business email address, please try again.'; | |
var cErrorMsg2 = 'Your email domain was not approved for registration. Please try again.'; | |
var oResponse = document.getElementById('response'); | |
var oForm = document.forms[0]; | |
var cRoleValue = oForm.UDF1007.value; | |
var cFormEmail = oForm.EMailAddress.value.split('@'); | |
var cDomainValue = ReturnDomain(cFormEmail[1].toUpperCase()); | |
var bCompetitorCheckForSubDomain = SubDomainCheck(aCapitalCompetitorBlockList, cDomainValue); | |
var bPersonalCheckForSubDomain = SubDomainCheck(aPersonalCompetitorBlockList, cDomainValue); | |
if (bCompetitorCheckForSubDomain) { | |
oResponse.innerHTML = cErrorMsg2; | |
return false; | |
} else if (bPersonalCheckForSubDomain && cRoleValue !== "Developer") { | |
oResponse.innerHTML = cErrorMsg1; | |
return false; | |
} | |
return true; | |
} //end ValidateEmail() | |
function ReturnDomain(cEmailAddress) { | |
return /\w+\.+(com|net|fm|fr|de|ru|be|es|(co+\.+(jp|uk|kr|id|in|))|(com+\.+(sg|ph|ar|mx))|(net+\.+(mx)))$/gi.exec(cEmailAddress)[0]; | |
} | |
function SubDomainCheck(aBlockList, cDomainValue) { | |
for (var i = 0; i < aBlockList.length; i++) { | |
if (cDomainValue == aBlockList[i]) return true; | |
}; | |
return false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment