From 5dd337a92e58a9babda992412e7b6fb8bfc4923c Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 21 May 2019 12:17:01 +0100 Subject: [PATCH] Move master-password generation out to it's own function --- modules/permissions/__init__.py | 8 ++++++-- 1 file 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")