URI: 
       tSetconfig: set rpc_user rpc_password in daemon (fix #6762). Do not disable auth if password is an empty string. - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 43c5df2ab5797a357b359e20c7fc1b6319b48026
   DIR parent 7e18e2ea3199380d78e75dec0da4e85939ddf170
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Wed, 25 Nov 2020 11:47:25 +0100
       
       Setconfig: set rpc_user rpc_password in daemon (fix #6762).
       Do not disable auth if password is an empty string.
       
       Diffstat:
         M electrum/commands.py                |       5 +++++
         M electrum/daemon.py                  |       6 ++++--
       
       2 files changed, 9 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/electrum/commands.py b/electrum/commands.py
       t@@ -293,6 +293,7 @@ class Commands:
            def _setconfig_normalize_value(cls, key, value):
                if key not in ('rpcuser', 'rpcpassword'):
                    value = json_decode(value)
       +            # call literal_eval for backward compatibility (see #4225)
                    try:
                        value = ast.literal_eval(value)
                    except:
       t@@ -303,6 +304,10 @@ class Commands:
            async def setconfig(self, key, value):
                """Set a configuration variable. 'value' may be a string or a Python expression."""
                value = self._setconfig_normalize_value(key, value)
       +        if self.daemon and key == 'rpcuser':
       +            self.daemon.commands_server.rpc_user = value
       +        if self.daemon and key == 'rpcpassword':
       +            self.daemon.commands_server.rpc_password = value
                self.config.set_key(key, value)
                return True
        
   DIR diff --git a/electrum/daemon.py b/electrum/daemon.py
       t@@ -120,6 +120,10 @@ def request(config: SimpleConfig, endpoint, args=(), timeout=60):
        def get_rpc_credentials(config: SimpleConfig) -> Tuple[str, str]:
            rpc_user = config.get('rpcuser', None)
            rpc_password = config.get('rpcpassword', None)
       +    if rpc_user == '':
       +        rpc_user = None
       +    if rpc_password == '':
       +        rpc_password = None
            if rpc_user is None or rpc_password is None:
                rpc_user = 'user'
                bits = 128
       t@@ -130,8 +134,6 @@ def get_rpc_credentials(config: SimpleConfig) -> Tuple[str, str]:
                rpc_password = to_string(pw_b64, 'ascii')
                config.set_key('rpcuser', rpc_user)
                config.set_key('rpcpassword', rpc_password, save=True)
       -    elif rpc_password == '':
       -        _logger.warning('RPC authentication is disabled.')
            return rpc_user, rpc_password