From e652a2e86f419d122e4da8c7220614bb82c367ee Mon Sep 17 00:00:00 2001 From: Goffi Date: Thu, 26 Nov 2015 15:49:58 +0100 Subject: [PATCH] jp (profile): fixed profile/modify command: - profile modify was resetting profile password if the option was not used - str types where used instead of unicode decoder - a new option allow to disable profile password (mutually exclusive with --password) - XMPP password was broken in a similar way as profile password --- frontends/src/jp/cmd_profile.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/frontends/src/jp/cmd_profile.py b/frontends/src/jp/cmd_profile.py index a33e57b6..68a014b5 100644 --- a/frontends/src/jp/cmd_profile.py +++ b/frontends/src/jp/cmd_profile.py @@ -143,22 +143,18 @@ class ProfileModify(base.CommandBase): super(ProfileModify, self).__init__(host, 'modify', need_connect=False, help=_('modify an existing profile')) def add_parser_options(self): - self.parser.add_argument('-w', '--password', type=str, default='', help=_('the password of the profile')) - self.parser.add_argument('-j', '--jid', type=str, help=_('the jid of the profile')) - self.parser.add_argument('-x', '--xmpp-password', type=str, help=_('the password of the XMPP account'), + profile_pwd_group = self.parser.add_mutually_exclusive_group() + profile_pwd_group.add_argument('-w', '--password', type=base.unicode_decoder, help=_('change the password of the profile')) + profile_pwd_group.add_argument('--disable-password', action='store_true', help=_('disable profile password (dangerous!)')) + self.parser.add_argument('-j', '--jid', type=base.unicode_decoder, help=_('the jid of the profile')) + self.parser.add_argument('-x', '--xmpp-password', type=base.unicode_decoder, help=_('change the password of the XMPP account'), metavar='PASSWORD') self.parser.add_argument('-D', '--default', action='store_true', help=_(u'set as default profile')) - def _profile_created(self): - if self.args.jid: - self.host.bridge.setParam("JabberID", self.args.jid, "Connection" ,profile_key=self.args.profile) - xmpp_pwd = self.args.password or self.args.xmpp_password - if xmpp_pwd: - self.host.bridge.setParam("Password", xmpp_pwd, "Connection", profile_key=self.args.profile) - self.host.quit() - def connected(self): super(ProfileModify, self).connected() + if self.args.disable_password: + self.args.password = '' if self.args.password is not None: self.host.bridge.setParam("Password", self.args.password, "General", profile_key=self.host.profile) if self.args.jid is not None: