VirtualMailManager/handler.py
branchv0.7.x
changeset 736 66a5f9a405da
parent 727 695426b49de0
child 750 8931c6b8435e
equal deleted inserted replaced
735:ddcad86f7386 736:66a5f9a405da
    38 from VirtualMailManager.emailaddress import DestinationEmailAddress, \
    38 from VirtualMailManager.emailaddress import DestinationEmailAddress, \
    39      EmailAddress, RE_LOCALPART
    39      EmailAddress, RE_LOCALPART
    40 from VirtualMailManager.errors import \
    40 from VirtualMailManager.errors import \
    41      DomainError, NotRootError, PermissionError, VMMError
    41      DomainError, NotRootError, PermissionError, VMMError
    42 from VirtualMailManager.mailbox import new as new_mailbox
    42 from VirtualMailManager.mailbox import new as new_mailbox
       
    43 from VirtualMailManager.password import extract_scheme, verify_scheme
    43 from VirtualMailManager.quotalimit import QuotaLimit
    44 from VirtualMailManager.quotalimit import QuotaLimit
    44 from VirtualMailManager.relocated import Relocated
    45 from VirtualMailManager.relocated import Relocated
    45 from VirtualMailManager.serviceset import ServiceSet, SERVICES
    46 from VirtualMailManager.serviceset import ServiceSet, SERVICES
    46 from VirtualMailManager.transport import Transport
    47 from VirtualMailManager.transport import Transport
    47 
    48 
   763         if not acc:
   764         if not acc:
   764             raise VMMError(_("The account '%s' does not exist.") %
   765             raise VMMError(_("The account '%s' does not exist.") %
   765                            acc.address, NO_SUCH_ACCOUNT)
   766                            acc.address, NO_SUCH_ACCOUNT)
   766         acc.update_password(password, scheme)
   767         acc.update_password(password, scheme)
   767 
   768 
       
   769     def user_pwhash(self, emailaddress, pwhash):
       
   770         """Wrapper for Account.modify('pwhash', ...)"""
       
   771         scheme = extract_scheme(pwhash)
       
   772         if not scheme:
       
   773             raise VMMError(_('Missing {SCHEME} prefix from password hash.'),
       
   774                            INVALID_ARGUMENT)
       
   775         else:
       
   776             scheme, encoding = verify_scheme(scheme)  # or die …
       
   777         acc = self._get_account(emailaddress)
       
   778         if not acc:
       
   779             raise VMMError(_("The account '%s' does not exist.") %
       
   780                            acc.address, NO_SUCH_ACCOUNT)
       
   781         acc.modify('pwhash', pwhash)
       
   782 
   768     def user_name(self, emailaddress, name):
   783     def user_name(self, emailaddress, name):
   769         """Wrapper for Account.modify('name', ...)."""
   784         """Wrapper for Account.modify('name', ...)."""
   770         acc = self._get_account(emailaddress)
   785         acc = self._get_account(emailaddress)
   771         if not acc:
   786         if not acc:
   772             raise VMMError(_("The account '%s' does not exist.") %
   787             raise VMMError(_("The account '%s' does not exist.") %