add the popup javascript to the html source only if user is not logged in?
Or create a mini API to fetch information about the currently logged in user (like http://example.com/api/v1/me) and call it using AJAX. If the user isn't logged in you can send back an error message.
Not sure if it'll help anyone but I did end up using AJAX (similar to what crhayes said above).
The AJAX function that will be called looks like this:
public function getLoginStatus()
{
return Response::json( array( 'status' => Sentry::check() ) );
}
/* getLoginStatus */
The jQuery initialisation looks like this:
jQuery.fn.timer = function()
{
$.get( "/ajax/login-status", function( data )
{
data.status == false ? $( 'li#status').show() : $( 'li#status').hide();
});
}
Bind the timer to the relevant page element like this:
window.setInterval(function()
{
$( "li#status" ).timer();
}, 1000);
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community