if we are logged out and do ajax, we can redirect to login page.

This is a port of a recent change in the rails2-openproject-branch.