VMM: Don't prompt endless for a password. Stop after 3rd failure.
--- a/VirtualMailManager/VirtualMailManager.py Tue Oct 20 18:58:09 2009 +0000
+++ b/VirtualMailManager/VirtualMailManager.py Thu Oct 22 18:40:06 2009 +0000
@@ -193,13 +193,19 @@
# TP: Please preserve the trailing space.
readp_msg1 = _(u'Retype new password: ').encode(ENCODING, 'replace')
mismatched = True
+ flrs = 0
while mismatched:
+ if flrs > 2:
+ raise VMMException(_(u'Too many failures - try again later.'),
+ ERR.VMM_TOO_MANY_FAILURES)
clear0 = getpass(prompt=readp_msg0)
clear1 = getpass(prompt=readp_msg1)
if clear0 != clear1:
+ flrs += 1
w_std(_(u'Sorry, passwords do not match'))
continue
- if len(clear0) < 1 or len(clear1) < 1:
+ if len(clear0) < 1:
+ flrs += 1
w_std(_(u'Sorry, empty passwords are not permitted'))
continue
mismatched = False
--- a/VirtualMailManager/constants/ERROR.py Tue Oct 20 18:58:09 2009 +0000
+++ b/VirtualMailManager/constants/ERROR.py Thu Oct 22 18:40:06 2009 +0000
@@ -49,3 +49,4 @@
UNKNOWN_SERVICE = 64
UNKNOWN_TRANSPORT_ID = 65
VMM_ERROR = 66
+VMM_TOO_MANY_FAILURES = 67