# HG changeset patch # User Pascal Volk # Date 1392500920 0 # Node ID 26a6231b9c6a1477ea07a0ce1c311a4b8b2e501c # Parent 69eb7a65d8a465d5d8f59768701848b6f79ff8b9 VMM/cli/handler: Improved CliHandler.user_password. When possible check the given password scheme before prompting for the password. diff -r 69eb7a65d8a4 -r 26a6231b9c6a VirtualMailManager/cli/handler.py --- 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)