Make the logic to manage login/logout link less confusing