Modified redirect before and after login