redirect to the previous page after login/logout