auto login and imporve redirect