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
This commit is contained in:
parent
c58da8d413
commit
e652a2e86f
1 changed files with 7 additions and 11 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue