Skip to content
Snippets Groups Projects
Commit 4519e38c authored by Seblu's avatar Seblu
Browse files

command passwd

parent 3a79194c
No related branches found
No related tags found
No related merge requests found
......@@ -332,6 +332,29 @@ class Command(object):
raise cmdError("RPCError: %s"%str(e))
cmd_delaccount.usage = "delaccount <name>"
def cmd_passwd(self, argv):
'''Change account password'''
if len(argv) == 2:
if not self.cli.interactive:
raise cmdError("You must give a password argument in non interactive mode!")
a = self.printer.getpass("Password: ")
b = self.printer.getpass("Again: ")
if a != b:
raise cmdError("You don't type twice the same password. Aborted")
argv.append(a)
elif len(argv) == 3:
if self.cli.interactive:
s = "You cannot set password with clear argument in interactive mode.\n"
s += "*** Think to clean your history! ***"
raise cmdError(s)
else:
raise cmdBadArgument()
try:
self.cli.rpc.passwd(argv[1], argv[2])
except RpcError as e:
raise cmdError("RPCError: %s"%str(e))
cmd_passwd.usage = "passwd <account> [password]"
class Alias(dict):
''' Alias wrapper'''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment