better login and redirect