<script>
var os_destination = "/"; 
if(getQueryVariableFromUrl("os_destination") !== "notfound"){
	os_destination = getQueryVariableFromUrl("os_destination");
}
if(getQueryVariableFromUrl("admin") === "notfound"){
	if(AJS.params.remoteUser === ""){
		console.log("about to redirect");
		window.location.replace("/login.action?os_destination=" + os_destination);
	} else {
		window.location.replace(os_destination);
	}
} 
</script>