From aff3f76fc12454b5a1f949e8a7fbbc230f01eca2 Mon Sep 17 00:00:00 2001 From: profitroll Date: Thu, 19 Jan 2023 15:31:40 +0100 Subject: [PATCH] Local account support added --- sync_gen.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sync_gen.py b/sync_gen.py index c83bc00..d280416 100644 --- a/sync_gen.py +++ b/sync_gen.py @@ -11,6 +11,8 @@ parser = ArgumentParser( ) parser.add_argument("-u", "--username", help="Enter username without input prompt", action="store") +parser.add_argument("-e", "--email", help="Enter email without input prompt", action="store") +parser.add_argument("-l", "--local", help="Do not save user's email to make it completely local and unrecoverable", action="store_trues") parser.add_argument("-j", "--json", help="Return output as a json. Username must be provided as an argument", action="store_true") args = parser.parse_args() @@ -18,8 +20,15 @@ args = parser.parse_args() username = input("Enter username: ") if args.username is None else args.username +if args.local is False: + email = input("Enter email: ") if args.email is None else args.email + if email.strip() == "": + email = None +else: + email = None + new_key = str(uuid4()) -col_apikeys.insert_one({"user": username, "hash": passEncode(new_key)}) +col_apikeys.insert_one({"user": username, "email": email, "hash": passEncode(new_key)}) if args.json is True and args.username is not None: print(dumps({"apikey": new_key}))