aboutsummaryrefslogtreecommitdiff
path: root/modules/permissions
diff options
context:
space:
mode:
authorGravatar jesopo2019-05-21 12:17:01 +0100
committerGravatar jesopo2019-05-21 12:17:01 +0100
commit5dd337a92e58a9babda992412e7b6fb8bfc4923c (patch)
tree3e0009c9a68a5740d860fb004180806d9509b800 /modules/permissions
parentRemove column from server.add SQL (leftover from removing 'ipv4' column) (diff)
signature
Move master-password generation out to it's own function
Diffstat (limited to 'modules/permissions')
-rw-r--r--modules/permissions/__init__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/permissions/__init__.py b/modules/permissions/__init__.py
index 3a45c395..b63a6022 100644
--- a/modules/permissions/__init__.py
+++ b/modules/permissions/__init__.py
@@ -13,11 +13,15 @@ class Module(ModuleManager.BaseModule):
self._logout(event["user"])
event["user"].admin_master = False
- def command_line(self, args: str):
- if args == "master-password":
+ def _master_password(self):
master_password = self._random_password()
hash, salt = self._make_hash(master_password)
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)
else:
raise ValueError("Unknown command-line argument")