VirtualMailManager/cli/subcommands.py
branchv0.7.x
changeset 737 81f4bfc34ed8
parent 728 69eb7a65d8a4
child 746 ee3c6c826b42
equal deleted inserted replaced
736:66a5f9a405da 737:81f4bfc34ed8
   394     ctx.hdlr.user_name(ctx.args.address.lower(), ctx.args.name)
   394     ctx.hdlr.user_name(ctx.args.address.lower(), ctx.args.name)
   395 
   395 
   396 
   396 
   397 def user_password(ctx):
   397 def user_password(ctx):
   398     """update the password for the given address"""
   398     """update the password for the given address"""
   399     ctx.hdlr.user_password(ctx.args.address.lower(), ctx.args.password,
   399     if ctx.args.pwhash:
   400                            ctx.args.scheme)
   400         if ctx.args.scheme:
       
   401             w_std(_('Info: The -s option is ignored when --hash was given.'))
       
   402         ctx.hdlr.user_pwhash(ctx.args.address.lower(), ctx.args.pwhash)
       
   403     else:
       
   404         ctx.hdlr.user_password(ctx.args.address.lower(), ctx.args.password,
       
   405                                ctx.args.scheme)
   401 
   406 
   402 
   407 
   403 def user_note(ctx):
   408 def user_note(ctx):
   404     """update the note of the given address"""
   409     """update the note of the given address"""
   405     ctx.hdlr.user_note(ctx.args.address.lower(), ctx.args.note)
   410     ctx.hdlr.user_note(ctx.args.address.lower(), ctx.args.note)
   830     uo.set_defaults(func=user_note, scmd='usernote')
   835     uo.set_defaults(func=user_note, scmd='usernote')
   831 
   836 
   832     up = a('userpassword', aliases=('up',),
   837     up = a('userpassword', aliases=('up',),
   833            help=_('update the password for the given address'),
   838            help=_('update the password for the given address'),
   834            epilog=fill(_("The password of an account can be updated with this "
   839            epilog=fill(_("The password of an account can be updated with this "
   835                "subcommand.\n\nIf no password was provided, vmm will prompt "
   840                "subcommand.\n\nIf neither a password nor a password hash was "
   836                "for it interactively. When the scheme was omitted, vmm will "
   841                "provided, vmm will prompt for the new password interactively. "
   837                "use misc.password_scheme from vmm.cfg. ")),
   842                "When the scheme was omitted, vmm will use "
       
   843                "misc.password_scheme from vmm.cfg. ")),
   838            formatter_class=RawDescriptionHelpFormatter)
   844            formatter_class=RawDescriptionHelpFormatter)
   839     up.add_argument('address',
   845     up.add_argument('address',
   840                     help=_("an account's e-mail address (local-part@fqdn)"))
   846                     help=_("an account's e-mail address (local-part@fqdn)"))
   841     up.add_argument('-p', metavar='PASSWORD', dest='password',
   847     up_grp = up.add_mutually_exclusive_group()
   842                     help=_("the user's new password"))
   848     up_grp.add_argument('-p', metavar='PASSWORD', dest='password',
       
   849                         help=_("the user's new password"))
   843     up.add_argument('-s', metavar='SCHEME', dest='scheme',
   850     up.add_argument('-s', metavar='SCHEME', dest='scheme',
   844                     help=_('scheme used for password hashing'))
   851                     help=_('scheme used for password hashing'))
       
   852     up_grp.add_argument('--hash', metavar='PWHASH', dest='pwhash',
       
   853                         help=_('set the given password hash as-is as new '
       
   854                                'password'))
   845     up.set_defaults(func=user_password, scmd='userpassword')
   855     up.set_defaults(func=user_password, scmd='userpassword')
   846 
   856 
   847     uq = a('userquota', aliases=('uq',),
   857     uq = a('userquota', aliases=('uq',),
   848            help=_('update the quota limit for the given address'),
   858            help=_('update the quota limit for the given address'),
   849            epilog=fill(_("This subcommand is used to set a new quota limit "
   859            epilog=fill(_("This subcommand is used to set a new quota limit "