From ceb4937c604a7382012d9740b917e7c6cfd8e44f Mon Sep 17 00:00:00 2001 From: magical Date: Sat, 6 Aug 2022 05:27:37 +0000 Subject: [PATCH] remove relog parameter --- clients/urwid/main.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/clients/urwid/main.py b/clients/urwid/main.py index 14778fa..d4542b6 100644 --- a/clients/urwid/main.py +++ b/clients/urwid/main.py @@ -1156,7 +1156,7 @@ class App(object): call("clear", shell=True) print(welcome) try: - log_in(relog=True) + log_in() except (KeyboardInterrupt, InterruptedError): pass self.loop.start() @@ -2395,17 +2395,15 @@ def nameloop(prompt, positive): return name -def log_in(relog=False, name="", password=""): +def log_in(name="", password=""): """ - Handles login or registration using an oldschool input() - chain. The user is run through this before starting the - curses app. A default name and password can be passed in - if relog is False. + Handles login or registration. If name and/or password are not + provided, the user is prompted for them using an oldschool + input() chain. The user is run through this before starting the + curses app. """ - if relog: + if not name: name = sane_value("user_name", "Username", return_empty=True) - else: - name = name or sane_value("user_name", "Username", return_empty=True) if name == "": motherfucking_rainbows("~~W3 4R3 4n0nYm0u5~~") else: @@ -2414,7 +2412,7 @@ def log_in(relog=False, name="", password=""): try: network.set_credentials( name, - password if not relog else "" + password if name and password else "" ) # make it easy for people who use an empty password =) motherfucking_rainbows("~~welcome back {}~~".format(network.user_name)) @@ -2582,9 +2580,9 @@ def main(): motherfucking_rainbows(obnoxious_logo) print(welcome) try: - user_name = get_arg("user") or os.getenv("BBJ_USER") + name = get_arg("user") or os.getenv("BBJ_USER") password = os.getenv("BBJ_PASSWORD", default="") - log_in(name=user_name, password=password) + log_in(name, password) app.index() app.loop.run() except (InterruptedError, KeyboardInterrupt):