Better login/logout and redirect behaviour