Merge branch 'set_password' into 'master'

Hide the value of  'password' field being displayed in the InfoTab. Fixes #3426

Closes #3426

See merge request poezio/poezio!24
This commit is contained in:
Maxime Buquet 2019-03-18 12:16:59 +01:00
commit 1a5d0493da
2 changed files with 6 additions and 0 deletions

View file

@ -447,6 +447,8 @@ class Config(RawConfigParser):
RawConfigParser.set(self, section, option, value) RawConfigParser.set(self, section, option, value)
if not self.write_in_file(section, option, value): if not self.write_in_file(section, option, value):
return ('Unable to write in the config file', 'Error') return ('Unable to write in the config file', 'Error')
if 'password' in option and 'eval_password' not in option:
value = '********'
return ("%s=%s" % (option, value), 'Info') return ("%s=%s" % (option, value), 'Info')
def remove_and_save(self, option: str, def remove_and_save(self, option: str,

View file

@ -526,6 +526,8 @@ class CommandCore:
theme.COLOR_INFORMATION_TEXT), theme.COLOR_INFORMATION_TEXT),
}) })
for option_name, option_value in section.items(): for option_name, option_value in section.items():
if 'password' in option_name and 'eval_password' not in option_name:
option_value = '********'
lines.append( lines.append(
'%s\x19%s}=\x19o%s' % '%s\x19%s}=\x19o%s' %
(option_name, dump_tuple( (option_name, dump_tuple(
@ -534,6 +536,8 @@ class CommandCore:
elif len(args) == 1: elif len(args) == 1:
option = args[0] option = args[0]
value = config.get(option) value = config.get(option)
if 'password' in option and 'eval_password' not in option and value is not None:
value = '********'
if value is None and '=' in option: if value is None and '=' in option:
args = option.split('=', 1) args = option.split('=', 1)
info = ('%s=%s' % (option, value), 'Info') info = ('%s=%s' % (option, value), 'Info')