Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
Jeroen Oudshoorn
2023-10-13 08:55:13 +02:00
parent d18c694e32
commit 474a1ddc46

View File

@ -46,16 +46,18 @@ def auth():
user_input = input("By completing these steps you give pwnagotchi access to your personal Google Drive!\n" user_input = input("By completing these steps you give pwnagotchi access to your personal Google Drive!\n"
"Personal credentials will be stored only locally for automated verification in the future.\n" "Personal credentials will be stored only locally for automated verification in the future.\n"
"No one else but you have access to these.\n" "No one else but you have access to these.\n"
"Do you agree? \n\n[y(es)/n(o)]") "Do you agree? \n\n[y(es)/n(o)]\n"
"Answer: ")
if user_input.lower() in ('y', 'yes'): if user_input.lower() in ('y', 'yes'):
if not os.path.exists("/root/client_secrets.json"): if not os.path.exists("/root/client_secrets.json"):
logging.error("client_secrets.json not found in /root. Please RTFM!") logging.error("client_secrets.json not found in /root. Please RTFM!")
return 0 return 0
try: try:
gauth = GoogleAuth(settings_file="/root/settings.yaml") gauth = GoogleAuth(settings_file="settings.yaml")
print(gauth.GetAuthUrl()) print(gauth.GetAuthUrl())
user_input = input("Please copy this URL into a browser, " user_input = input("Please copy this URL into a browser, "
"complete the verification and then copy/paste the code from addressbar.") "complete the verification and then copy/paste the code from addressbar.\n\n"
"Code: ")
gauth.Auth(user_input) gauth.Auth(user_input)
gauth.SaveCredentialsFile("credentials.json") gauth.SaveCredentialsFile("credentials.json")
except Exception as e: except Exception as e: