catch login error + update readme with potential security issue.

This commit is contained in:
Jamie
2021-03-19 10:39:26 -04:00
parent ad421f5444
commit 08d44e1472
2 changed files with 13 additions and 2 deletions

View File

@@ -9,6 +9,9 @@ login
````
Which will use your login information, which should be stored as environment variables in [config file](/gamestonk_terminal/config_terminal.py)
Robinhood has Two Factor Autentication, so you will likely be prompted to enter a code that is texted/emailed to you.
###NOTE THAT LOGGING IN WILL SAVE A TOKEN TO `os.path.expanduser("~")/.tokens` WHICH CAN BE USED TO LOGIN EVEN IF USER CREDENTIALS ARE INCORRECT.
[ROBINHOOD](#ROBINHOOD)
* [hold](#hold)
* Look at current (stock only) holdings

View File

@@ -1,4 +1,5 @@
import argparse
import time
from matplotlib import pyplot as plt
from prompt_toolkit.completion import NestedCompleter
from gamestonk_terminal import feature_flags as gtff
@@ -26,7 +27,7 @@ def print_port(show_login):
def port_menu():
plt.close("all")
port_parser = argparse.ArgumentParser(prog="port", add_help=False)
choices = ["help", "q", "quit", "hold", "rhhist", "login", "logoff"]
choices = ["help", "q", "quit", "hold", "rhhist", "login"]
port_parser.add_argument("cmd", choices=choices)
completer = NestedCompleter.from_nested_dict({c: None for c in choices})
should_print_help = True
@@ -83,9 +84,16 @@ def port_menu():
rh_api.plot_historical(l_args)
elif ns_known_args.cmd == "login":
rh_api.login()
try:
rh_api.login()
except Exception as e:
print(e)
print("Incorrect Login")
print("")
time.sleep(2)
should_print_help = True
print_login = False
else:
print("Command not recognized")
print("")