<?php
// The key from [Settings] > [Company] > [Plugins] > [Shared Login]
$key = "0123456789abcdef0123456789abcde";
$t = time();
$u = "client_username";
$h = hash_hmac("sha256", $t . $u . $r, $key);
$url = "https://yourdomain.com/path_to_blesta/plugin/shared_login/";
?>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.get(
'<?php echo htmlentities($url, ENT_QUOTES);?>',
{u: '<?php echo htmlentities($u, ENT_QUOTES);?>', t: '<?php echo htmlentities($t, ENT_QUOTES);?>', h: '<?php echo htmlentities($h, ENT_QUOTES);?>'},
function(data) {
if (data.success)
alert('logged into Blesta');
else
alert('login failed!');
},
'json'
);
});
</script> |