VirtualMailManager/cli/handler.py
branchv0.7.x
changeset 729 26a6231b9c6a
parent 727 695426b49de0
equal deleted inserted replaced
728:69eb7a65d8a4 729:26a6231b9c6a
    14 from VirtualMailManager.handler import Handler
    14 from VirtualMailManager.handler import Handler
    15 from VirtualMailManager.cli import read_pass
    15 from VirtualMailManager.cli import read_pass
    16 from VirtualMailManager.cli.config import CliConfig as Cfg
    16 from VirtualMailManager.cli.config import CliConfig as Cfg
    17 from VirtualMailManager.constants import ACCOUNT_EXISTS, INVALID_SECTION, \
    17 from VirtualMailManager.constants import ACCOUNT_EXISTS, INVALID_SECTION, \
    18      NO_SUCH_ACCOUNT, TYPE_ACCOUNT
    18      NO_SUCH_ACCOUNT, TYPE_ACCOUNT
    19 from VirtualMailManager.password import randompw
    19 from VirtualMailManager.password import randompw, verify_scheme
    20 
    20 
    21 _ = lambda msg: msg
    21 _ = lambda msg: msg
    22 
    22 
    23 
    23 
    24 class CliHandler(Handler):
    24 class CliHandler(Handler):
    92         password dialog."""
    92         password dialog."""
    93         acc = self._get_account(emailaddress)
    93         acc = self._get_account(emailaddress)
    94         if not acc:
    94         if not acc:
    95             raise VMMError(_("The account '%s' does not exist.") %
    95             raise VMMError(_("The account '%s' does not exist.") %
    96                            acc.address, NO_SUCH_ACCOUNT)
    96                            acc.address, NO_SUCH_ACCOUNT)
       
    97         if scheme:
       
    98             scheme, encoding = verify_scheme(scheme)
       
    99             if encoding:
       
   100                 scheme = '%s.%s' % (scheme, encoding)
    97         if not isinstance(password, str) or not password:
   101         if not isinstance(password, str) or not password:
    98             password = read_pass()
   102             password = read_pass()
    99         acc.update_password(password, scheme)
   103         acc.update_password(password, scheme)
   100 
   104 
   101 del _
   105 del _