pass the initial username and password to log_in explicitly
parent
b1d1de659d
commit
3e4f3de2a8
|
@ -2395,18 +2395,17 @@ def nameloop(prompt, positive):
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
||||||
def log_in(relog=False):
|
def log_in(relog=False, name="", password=""):
|
||||||
"""
|
"""
|
||||||
Handles login or registration using an oldschool input()
|
Handles login or registration using an oldschool input()
|
||||||
chain. The user is run through this before starting the
|
chain. The user is run through this before starting the
|
||||||
curses app.
|
curses app. A default name and password can be passed in
|
||||||
|
if relog is False.
|
||||||
"""
|
"""
|
||||||
if relog:
|
if relog:
|
||||||
name = sane_value("user_name", "Username", return_empty=True)
|
name = sane_value("user_name", "Username", return_empty=True)
|
||||||
else:
|
else:
|
||||||
name = get_arg("user") \
|
name = name or sane_value("user_name", "Username", return_empty=True)
|
||||||
or os.getenv("BBJ_USER") \
|
|
||||||
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:
|
||||||
|
@ -2415,8 +2414,7 @@ def log_in(relog=False):
|
||||||
try:
|
try:
|
||||||
network.set_credentials(
|
network.set_credentials(
|
||||||
name,
|
name,
|
||||||
os.getenv("BBJ_PASSWORD", default="")
|
password if not relog else ""
|
||||||
if not relog 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))
|
||||||
|
@ -2584,7 +2582,9 @@ def main():
|
||||||
motherfucking_rainbows(obnoxious_logo)
|
motherfucking_rainbows(obnoxious_logo)
|
||||||
print(welcome)
|
print(welcome)
|
||||||
try:
|
try:
|
||||||
log_in()
|
user_name = get_arg("user") or os.getenv("BBJ_USER")
|
||||||
|
password = os.getenv("BBJ_PASSWORD", default="")
|
||||||
|
log_in(name=user_name, password=password)
|
||||||
app.index()
|
app.index()
|
||||||
app.loop.run()
|
app.loop.run()
|
||||||
except (InterruptedError, KeyboardInterrupt):
|
except (InterruptedError, KeyboardInterrupt):
|
||||||
|
|
Loading…
Reference in New Issue