VirtualMailManager/VirtualMailManager.py
changeset 158 6949f6eaf26e
parent 156 a849843115e9
child 162 0ac9ef587769
equal deleted inserted replaced
157:eb3ccf9484b3 158:6949f6eaf26e
   191         # TP: Please preserve the trailing space.
   191         # TP: Please preserve the trailing space.
   192         readp_msg0 = _(u'Enter new password: ').encode(ENCODING, 'replace')
   192         readp_msg0 = _(u'Enter new password: ').encode(ENCODING, 'replace')
   193         # TP: Please preserve the trailing space.
   193         # TP: Please preserve the trailing space.
   194         readp_msg1 = _(u'Retype new password: ').encode(ENCODING, 'replace')
   194         readp_msg1 = _(u'Retype new password: ').encode(ENCODING, 'replace')
   195         mismatched = True
   195         mismatched = True
       
   196         flrs = 0
   196         while mismatched:
   197         while mismatched:
       
   198             if flrs > 2:
       
   199                 raise VMMException(_(u'Too many failures - try again later.'),
       
   200                         ERR.VMM_TOO_MANY_FAILURES)
   197             clear0 = getpass(prompt=readp_msg0)
   201             clear0 = getpass(prompt=readp_msg0)
   198             clear1 = getpass(prompt=readp_msg1)
   202             clear1 = getpass(prompt=readp_msg1)
   199             if clear0 != clear1:
   203             if clear0 != clear1:
       
   204                 flrs += 1
   200                 w_std(_(u'Sorry, passwords do not match'))
   205                 w_std(_(u'Sorry, passwords do not match'))
   201                 continue
   206                 continue
   202             if len(clear0) < 1 or len(clear1) < 1:
   207             if len(clear0) < 1:
       
   208                 flrs += 1
   203                 w_std(_(u'Sorry, empty passwords are not permitted'))
   209                 w_std(_(u'Sorry, empty passwords are not permitted'))
   204                 continue
   210                 continue
   205             mismatched = False
   211             mismatched = False
   206         return clear0
   212         return clear0
   207 
   213