added login redirection (couldn't add cookies on a 302 for some reason)