put back the redirect function as it was in branch 1.6 (still not working perfectly with the auto_login)