remove relog parameter

master
magical 2022-08-06 05:27:37 +00:00
parent 3e4f3de2a8
commit ceb4937c60
1 changed files with 10 additions and 12 deletions

View File

@ -1156,7 +1156,7 @@ class App(object):
call("clear", shell=True) call("clear", shell=True)
print(welcome) print(welcome)
try: try:
log_in(relog=True) log_in()
except (KeyboardInterrupt, InterruptedError): except (KeyboardInterrupt, InterruptedError):
pass pass
self.loop.start() self.loop.start()
@ -2395,17 +2395,15 @@ def nameloop(prompt, positive):
return name return name
def log_in(relog=False, name="", password=""): def log_in(name="", password=""):
""" """
Handles login or registration using an oldschool input() Handles login or registration. If name and/or password are not
chain. The user is run through this before starting the provided, the user is prompted for them using an oldschool
curses app. A default name and password can be passed in input() chain. The user is run through this before starting the
if relog is False. curses app.
""" """
if relog: if not name:
name = sane_value("user_name", "Username", return_empty=True) name = sane_value("user_name", "Username", return_empty=True)
else:
name = name or sane_value("user_name", "Username", return_empty=True)
if name == "": if name == "":
motherfucking_rainbows("~~W3 4R3 4n0nYm0u5~~") motherfucking_rainbows("~~W3 4R3 4n0nYm0u5~~")
else: else:
@ -2414,7 +2412,7 @@ def log_in(relog=False, name="", password=""):
try: try:
network.set_credentials( network.set_credentials(
name, name,
password if not relog else "" password if name and password else ""
) )
# make it easy for people who use an empty password =) # make it easy for people who use an empty password =)
motherfucking_rainbows("~~welcome back {}~~".format(network.user_name)) motherfucking_rainbows("~~welcome back {}~~".format(network.user_name))
@ -2582,9 +2580,9 @@ def main():
motherfucking_rainbows(obnoxious_logo) motherfucking_rainbows(obnoxious_logo)
print(welcome) print(welcome)
try: 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="") password = os.getenv("BBJ_PASSWORD", default="")
log_in(name=user_name, password=password) log_in(name, password)
app.index() app.index()
app.loop.run() app.loop.run()
except (InterruptedError, KeyboardInterrupt): except (InterruptedError, KeyboardInterrupt):