prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Conan doesn't keep the username to log to server anymore
  From conan 1.8,
  
  When an authentication is required by the conan server, the username is now always asked event though it was specified by conan user. In older version, only the password was required.
  
  To reproduce:
  ```
  $ conan user -c
  $ conan user username
  Changed user of remote 'server' from 'None' (anonymous) to 'username'
  $ conan search -r server *
  Please log in to "server" to perform this action. Execute "conan user" command.
  Remote 'server' username:
  ```
  
  To help us debug your issue please explain:
  
  - [X] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).
  - [X] I've specified the Conan version, operating system version and any tool that can be relevant.
  - [X] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.
  
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `conans/client/userio.py`
  Content:
  ```
  1 import os
  2 import sys
  3 from conans.client.output import ConanOutput
  4 from conans.errors import InvalidNameException, ConanException
  5 import getpass
  6 from six.moves import input as raw_input
  7 
  8 
  9 class UserIO(object):
  10     """Class to interact with the user, used to show messages and ask for information"""
  11 
  12     def __init__(self, ins=sys.stdin, out=None):
  13         """
  14         Params:
  15             ins: input stream
  16             out: ConanOutput, should have "write" method
  17         """
  18         self._ins = ins
  19         if not out:
  20             out = ConanOutput(sys.stdout)
  21         self.out = out
  22         self._interactive = True
  23 
  24     def disable_input(self):
  25         self._interactive = False
  26 
  27     def _raise_if_non_interactive(self):
  28         if not self._interactive:
  29             raise ConanException("Conan interactive mode disabled")
  30 
  31     def raw_input(self):
  32         self._raise_if_non_interactive()
  33         return raw_input()
  34 
  35     def get_pass(self):
  36         self._raise_if_non_interactive()
  37         return getpass.getpass("")
  38 
  39     def request_login(self, remote_name, username=None):
  40         """Request user to input their name and password
  41         :param username If username is specified it only request password"""
  42         if self._interactive:
  43             self.out.write("Remote '%s' username: " % remote_name)
  44         username = self.get_username(remote_name)
  45 
  46         if self._interactive:
  47             self.out.write('Please enter a password for "%s" account: ' % username)
  48         try:
  49             pwd = self.get_password(remote_name)
  50         except ConanException:
  51             raise
  52         except Exception as e:
  53             raise ConanException('Cancelled pass %s' % e)
  54         return username, pwd
  55 
  56     def get_username(self, remote_name):
  57         """Overridable for testing purpose"""
  58         return self._get_env_username(remote_name) or self.raw_input()
  59 
  60     def get_password(self, remote_name):
  61         """Overridable for testing purpose"""
  62         return self._get_env_password(remote_name) or self.get_pass()
  63 
  64     def request_string(self, msg, default_value=None):
  65         """Request user to input a msg
  66         :param msg Name of the msg
  67         """
  68         self._raise_if_non_interactive()
  69 
  70         if default_value:
  71             self.out.input_text('%s (%s): ' % (msg, default_value))
  72         else:
  73             self.out.input_text('%s: ' % msg)
  74         s = self._ins.readline().replace("\n", "")
  75         if default_value is not None and s == '':
  76             return default_value
  77         return s
  78 
  79     def request_boolean(self, msg, default_option=None):
  80         """Request user to input a boolean"""
  81         ret = None
  82         while ret is None:
  83             if default_option is True:
  84                 s = self.request_string("%s (YES/no)" % msg)
  85             elif default_option is False:
  86                 s = self.request_string("%s (NO/yes)" % msg)
  87             else:
  88                 s = self.request_string("%s (yes/no)" % msg)
  89             if default_option is not None and s == '':
  90                 return default_option
  91             if s.lower() in ['yes', 'y']:
  92                 ret = True
  93             elif s.lower() in ['no', 'n']:
  94                 ret = False
  95             else:
  96                 self.out.error("%s is not a valid answer" % s)
  97         return ret
  98 
  99     def _get_env_password(self, remote_name):
  100         """
  101         Try CONAN_PASSWORD_REMOTE_NAME or CONAN_PASSWORD or return None
  102         """
  103         remote_name = remote_name.replace("-", "_").upper()
  104         var_name = "CONAN_PASSWORD_%s" % remote_name
  105         ret = os.getenv(var_name, None) or os.getenv("CONAN_PASSWORD", None)
  106         if ret:
  107             self.out.info("Got password '******' from environment")
  108         return ret
  109 
  110     def _get_env_username(self, remote_name):
  111         """
  112         Try CONAN_LOGIN_USERNAME_REMOTE_NAME or CONAN_LOGIN_USERNAME or return None
  113         """
  114         remote_name = remote_name.replace("-", "_").upper()
  115         var_name = "CONAN_LOGIN_USERNAME_%s" % remote_name
  116         ret = os.getenv(var_name, None) or os.getenv("CONAN_LOGIN_USERNAME", None)
  117 
  118         if ret:
  119             self.out.info("Got username '%s' from environment" % ret)
  120         return ret
  121
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/conans/client/userio.py b/conans/client/userio.py
  --- a/conans/client/userio.py
  +++ b/conans/client/userio.py
  @@ -39,9 +39,11 @@
       def request_login(self, remote_name, username=None):
           """Request user to input their name and password
           :param username If username is specified it only request password"""
  -        if self._interactive:
  -            self.out.write("Remote '%s' username: " % remote_name)
  -        username = self.get_username(remote_name)
  +
  +        if not username:
  +            if self._interactive:
  +                self.out.write("Remote '%s' username: " % remote_name)
  +            username = self.get_username(remote_name)
   
           if self._interactive:
               self.out.write('Please enter a password for "%s" account: ' % username)
  
verification_info: {"golden_diff": "diff --git a/conans/client/userio.py b/conans/client/userio.py\n--- a/conans/client/userio.py\n+++ b/conans/client/userio.py\n@@ -39,9 +39,11 @@\n     def request_login(self, remote_name, username=None):\n         \"\"\"Request user to input their name and password\n         :param username If username is specified it only request password\"\"\"\n-        if self._interactive:\n-            self.out.write(\"Remote '%s' username: \" % remote_name)\n-        username = self.get_username(remote_name)\n+\n+        if not username:\n+            if self._interactive:\n+                self.out.write(\"Remote '%s' username: \" % remote_name)\n+            username = self.get_username(remote_name)\n \n         if self._interactive:\n             self.out.write('Please enter a password for \"%s\" account: ' % username)\n", "issue": "Conan doesn't keep the username to log to server anymore\nFrom conan 1.8,\r\n\r\nWhen an authentication is required by the conan server, the username is now always asked event though it was specified by conan user. In older version, only the password was required.\r\n\r\nTo reproduce:\r\n```\r\n$ conan user -c\r\n$ conan user username\r\nChanged user of remote 'server' from 'None' (anonymous) to 'username'\r\n$ conan search -r server *\r\nPlease log in to \"server\" to perform this action. Execute \"conan user\" command.\r\nRemote 'server' username:\r\n```\r\n\r\nTo help us debug your issue please explain:\r\n\r\n- [X] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).\r\n- [X] I've specified the Conan version, operating system version and any tool that can be relevant.\r\n- [X] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.\r\n\r\n\n", "before_files": [{"content": "import os\nimport sys\nfrom conans.client.output import ConanOutput\nfrom conans.errors import InvalidNameException, ConanException\nimport getpass\nfrom six.moves import input as raw_input\n\n\nclass UserIO(object):\n    \"\"\"Class to interact with the user, used to show messages and ask for information\"\"\"\n\n    def __init__(self, ins=sys.stdin, out=None):\n        \"\"\"\n        Params:\n            ins: input stream\n            out: ConanOutput, should have \"write\" method\n        \"\"\"\n        self._ins = ins\n        if not out:\n            out = ConanOutput(sys.stdout)\n        self.out = out\n        self._interactive = True\n\n    def disable_input(self):\n        self._interactive = False\n\n    def _raise_if_non_interactive(self):\n        if not self._interactive:\n            raise ConanException(\"Conan interactive mode disabled\")\n\n    def raw_input(self):\n        self._raise_if_non_interactive()\n        return raw_input()\n\n    def get_pass(self):\n        self._raise_if_non_interactive()\n        return getpass.getpass(\"\")\n\n    def request_login(self, remote_name, username=None):\n        \"\"\"Request user to input their name and password\n        :param username If username is specified it only request password\"\"\"\n        if self._interactive:\n            self.out.write(\"Remote '%s' username: \" % remote_name)\n        username = self.get_username(remote_name)\n\n        if self._interactive:\n            self.out.write('Please enter a password for \"%s\" account: ' % username)\n        try:\n            pwd = self.get_password(remote_name)\n        except ConanException:\n            raise\n        except Exception as e:\n            raise ConanException('Cancelled pass %s' % e)\n        return username, pwd\n\n    def get_username(self, remote_name):\n        \"\"\"Overridable for testing purpose\"\"\"\n        return self._get_env_username(remote_name) or self.raw_input()\n\n    def get_password(self, remote_name):\n        \"\"\"Overridable for testing purpose\"\"\"\n        return self._get_env_password(remote_name) or self.get_pass()\n\n    def request_string(self, msg, default_value=None):\n        \"\"\"Request user to input a msg\n        :param msg Name of the msg\n        \"\"\"\n        self._raise_if_non_interactive()\n\n        if default_value:\n            self.out.input_text('%s (%s): ' % (msg, default_value))\n        else:\n            self.out.input_text('%s: ' % msg)\n        s = self._ins.readline().replace(\"\\n\", \"\")\n        if default_value is not None and s == '':\n            return default_value\n        return s\n\n    def request_boolean(self, msg, default_option=None):\n        \"\"\"Request user to input a boolean\"\"\"\n        ret = None\n        while ret is None:\n            if default_option is True:\n                s = self.request_string(\"%s (YES/no)\" % msg)\n            elif default_option is False:\n                s = self.request_string(\"%s (NO/yes)\" % msg)\n            else:\n                s = self.request_string(\"%s (yes/no)\" % msg)\n            if default_option is not None and s == '':\n                return default_option\n            if s.lower() in ['yes', 'y']:\n                ret = True\n            elif s.lower() in ['no', 'n']:\n                ret = False\n            else:\n                self.out.error(\"%s is not a valid answer\" % s)\n        return ret\n\n    def _get_env_password(self, remote_name):\n        \"\"\"\n        Try CONAN_PASSWORD_REMOTE_NAME or CONAN_PASSWORD or return None\n        \"\"\"\n        remote_name = remote_name.replace(\"-\", \"_\").upper()\n        var_name = \"CONAN_PASSWORD_%s\" % remote_name\n        ret = os.getenv(var_name, None) or os.getenv(\"CONAN_PASSWORD\", None)\n        if ret:\n            self.out.info(\"Got password '******' from environment\")\n        return ret\n\n    def _get_env_username(self, remote_name):\n        \"\"\"\n        Try CONAN_LOGIN_USERNAME_REMOTE_NAME or CONAN_LOGIN_USERNAME or return None\n        \"\"\"\n        remote_name = remote_name.replace(\"-\", \"_\").upper()\n        var_name = \"CONAN_LOGIN_USERNAME_%s\" % remote_name\n        ret = os.getenv(var_name, None) or os.getenv(\"CONAN_LOGIN_USERNAME\", None)\n\n        if ret:\n            self.out.info(\"Got username '%s' from environment\" % ret)\n        return ret\n", "path": "conans/client/userio.py"}], "after_files": [{"content": "import os\nimport sys\nfrom conans.client.output import ConanOutput\nfrom conans.errors import InvalidNameException, ConanException\nimport getpass\nfrom six.moves import input as raw_input\n\n\nclass UserIO(object):\n    \"\"\"Class to interact with the user, used to show messages and ask for information\"\"\"\n\n    def __init__(self, ins=sys.stdin, out=None):\n        \"\"\"\n        Params:\n            ins: input stream\n            out: ConanOutput, should have \"write\" method\n        \"\"\"\n        self._ins = ins\n        if not out:\n            out = ConanOutput(sys.stdout)\n        self.out = out\n        self._interactive = True\n\n    def disable_input(self):\n        self._interactive = False\n\n    def _raise_if_non_interactive(self):\n        if not self._interactive:\n            raise ConanException(\"Conan interactive mode disabled\")\n\n    def raw_input(self):\n        self._raise_if_non_interactive()\n        return raw_input()\n\n    def get_pass(self):\n        self._raise_if_non_interactive()\n        return getpass.getpass(\"\")\n\n    def request_login(self, remote_name, username=None):\n        \"\"\"Request user to input their name and password\n        :param username If username is specified it only request password\"\"\"\n\n        if not username:\n            if self._interactive:\n                self.out.write(\"Remote '%s' username: \" % remote_name)\n            username = self.get_username(remote_name)\n\n        if self._interactive:\n            self.out.write('Please enter a password for \"%s\" account: ' % username)\n        try:\n            pwd = self.get_password(remote_name)\n        except ConanException:\n            raise\n        except Exception as e:\n            raise ConanException('Cancelled pass %s' % e)\n        return username, pwd\n\n    def get_username(self, remote_name):\n        \"\"\"Overridable for testing purpose\"\"\"\n        return self._get_env_username(remote_name) or self.raw_input()\n\n    def get_password(self, remote_name):\n        \"\"\"Overridable for testing purpose\"\"\"\n        return self._get_env_password(remote_name) or self.get_pass()\n\n    def request_string(self, msg, default_value=None):\n        \"\"\"Request user to input a msg\n        :param msg Name of the msg\n        \"\"\"\n        self._raise_if_non_interactive()\n\n        if default_value:\n            self.out.input_text('%s (%s): ' % (msg, default_value))\n        else:\n            self.out.input_text('%s: ' % msg)\n        s = self._ins.readline().replace(\"\\n\", \"\")\n        if default_value is not None and s == '':\n            return default_value\n        return s\n\n    def request_boolean(self, msg, default_option=None):\n        \"\"\"Request user to input a boolean\"\"\"\n        ret = None\n        while ret is None:\n            if default_option is True:\n                s = self.request_string(\"%s (YES/no)\" % msg)\n            elif default_option is False:\n                s = self.request_string(\"%s (NO/yes)\" % msg)\n            else:\n                s = self.request_string(\"%s (yes/no)\" % msg)\n            if default_option is not None and s == '':\n                return default_option\n            if s.lower() in ['yes', 'y']:\n                ret = True\n            elif s.lower() in ['no', 'n']:\n                ret = False\n            else:\n                self.out.error(\"%s is not a valid answer\" % s)\n        return ret\n\n    def _get_env_password(self, remote_name):\n        \"\"\"\n        Try CONAN_PASSWORD_REMOTE_NAME or CONAN_PASSWORD or return None\n        \"\"\"\n        remote_name = remote_name.replace(\"-\", \"_\").upper()\n        var_name = \"CONAN_PASSWORD_%s\" % remote_name\n        ret = os.getenv(var_name, None) or os.getenv(\"CONAN_PASSWORD\", None)\n        if ret:\n            self.out.info(\"Got password '******' from environment\")\n        return ret\n\n    def _get_env_username(self, remote_name):\n        \"\"\"\n        Try CONAN_LOGIN_USERNAME_REMOTE_NAME or CONAN_LOGIN_USERNAME or return None\n        \"\"\"\n        remote_name = remote_name.replace(\"-\", \"_\").upper()\n        var_name = \"CONAN_LOGIN_USERNAME_%s\" % remote_name\n        ret = os.getenv(var_name, None) or os.getenv(\"CONAN_LOGIN_USERNAME\", None)\n\n        if ret:\n            self.out.info(\"Got username '%s' from environment\" % ret)\n        return ret\n", "path": "conans/client/userio.py"}]}