rewritten the page refresh to an ajax call that checks if the your is logged in. If this is the case a window.location is triggered