added redirect to login page when not logged in

if an AJAX request is returned saying that the user must login, you are
redirected to the login page.