no login, go to prompt

This commit is contained in:
Diogo Sousa
2023-01-19 19:16:52 +00:00
parent be5fc3eda0
commit 2733834f06
2 changed files with 7 additions and 4 deletions

View File

@@ -12,7 +12,10 @@ from openbb_terminal.account.login_model import (
def display_welcome_message():
"""Display welcome message"""
console.print("You need to be connected to use the installer version of OpenBB.\n")
console.print(
"You need to log in to use the installer version of OpenBB.",
style="info",
)
def get_user_input() -> Tuple[str, str, bool]:
@@ -23,7 +26,7 @@ def get_user_input() -> Tuple[str, str, bool]:
Tuple[str, str, bool]
The user email, password and save login option.
"""
console.print("\nPlease enter your credentials:")
console.print("\nPlease enter your credentials:", style="info")
email = console.input("> Email: ", style="blue")
password = console.getpass("> Password: ", style="blue")
@@ -61,7 +64,7 @@ def login_prompt(welcome=True):
def main():
"""Main function"""
login_info = get_login_info()
if login_info == Error.READ_ERROR:
if login_info == Error.READ_ERROR or not login_info:
login_prompt()
else:
status = get_login_status(login_info=login_info)

View File

@@ -146,7 +146,7 @@ def get_login_info() -> Union[dict, Error]:
try:
if os.path.isfile(file_path):
with open(file_path, "r") as file:
with open(file_path) as file:
return json.load(file)
except Exception:
console.print(Error.READ_ERROR.value)