added redirect function for login