Created
August 6, 2015 00:45
-
-
Save raphaelchaib/b8185255067efff29835 to your computer and use it in GitHub Desktop.
VTEX: User login functions
This file contains hidden or 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
/** | |
* isVTEXUserIdentified | |
* Verifica se o usuário VTEX está identificado (quando o sistema identificou | |
* o usuário pelo e-mail, mas ele ainda não digitou sua senha). | |
* | |
* @return BOOL | |
* TRUE - Se se estiver identificado ou autenticado | |
* FALSE - Se não estiver identificado | |
*/ | |
function isVTEXUserIdentified() { | |
return /VtexRC/.test(document.cookie); | |
} | |
/** | |
* isVTEXUserAuthenticated | |
* Verifica se o usuário VTEX está autenticado (quando o usuário | |
* já digitou sua senha). | |
* | |
* @return BOOL | |
* TRUE - Se se estiver autenticado | |
* FALSE - Se não estiver autenticado (isso não significa | |
* que ele não está identificado) | |
*/ | |
function isVTEXUserAuthenticated() { | |
ret = false; | |
for(var i in dataLayer) { | |
for(var key in dataLayer[i]) { | |
if(key=='visitorLoginState' && dataLayer[i][key]===true) ret=true; | |
} | |
} | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment