Move master-password generation out to it's own function
This commit is contained in:
parent
6678076490
commit
5dd337a92e
1 changed files with 6 additions and 2 deletions
|
@ -13,11 +13,15 @@ class Module(ModuleManager.BaseModule):
|
||||||
self._logout(event["user"])
|
self._logout(event["user"])
|
||||||
event["user"].admin_master = False
|
event["user"].admin_master = False
|
||||||
|
|
||||||
def command_line(self, args: str):
|
def _master_password(self):
|
||||||
if args == "master-password":
|
|
||||||
master_password = self._random_password()
|
master_password = self._random_password()
|
||||||
hash, salt = self._make_hash(master_password)
|
hash, salt = self._make_hash(master_password)
|
||||||
self.bot.set_setting("master-password", [hash, salt])
|
self.bot.set_setting("master-password", [hash, salt])
|
||||||
|
return master_password
|
||||||
|
|
||||||
|
def command_line(self, args: str):
|
||||||
|
if args == "master-password":
|
||||||
|
master_password = self._master_password()
|
||||||
print("one-time master password: %s" % master_password)
|
print("one-time master password: %s" % master_password)
|
||||||
else:
|
else:
|
||||||
raise ValueError("Unknown command-line argument")
|
raise ValueError("Unknown command-line argument")
|
||||||
|
|
Loading…
Reference in a new issue