old-sites/c2015/login/protectedHandler.js

28 lines
588 B
JavaScript
Raw Normal View History

2019-11-22 17:57:53 +00:00
var email, sessionKey, sessionVal;
function onSignIn(googleUser){
var profile = googleUser.getBasicProfile();
email = profile.email;
//
sessionKey = email;
sessionVal = localStorage.getItem(sessionKey);
}
function doAuthCheck(){
if (sessionVal != "in") {
alert("authError!");
} else {alert("auth successful")}
}
$(window).load(function ()
{
var i = setInterval(function ()
{
if ($('#foo').length)
{
clearInterval(i);
// safe to execute your code here
doAuthCheck();
}
}, 2000);
});