VMM/cli/handler: Improved CliHandler.user_password.
When possible check the given password scheme before prompting for
the password.
--- a/VirtualMailManager/cli/handler.py Sat Feb 15 19:00:40 2014 +0000
+++ b/VirtualMailManager/cli/handler.py Sat Feb 15 21:48:40 2014 +0000
@@ -16,7 +16,7 @@
from VirtualMailManager.cli.config import CliConfig as Cfg
from VirtualMailManager.constants import ACCOUNT_EXISTS, INVALID_SECTION, \
NO_SUCH_ACCOUNT, TYPE_ACCOUNT
-from VirtualMailManager.password import randompw
+from VirtualMailManager.password import randompw, verify_scheme
_ = lambda msg: msg
@@ -94,6 +94,10 @@
if not acc:
raise VMMError(_("The account '%s' does not exist.") %
acc.address, NO_SUCH_ACCOUNT)
+ if scheme:
+ scheme, encoding = verify_scheme(scheme)
+ if encoding:
+ scheme = '%s.%s' % (scheme, encoding)
if not isinstance(password, str) or not password:
password = read_pass()
acc.update_password(password, scheme)