-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved the authentication code to another file
- Loading branch information
Showing
6 changed files
with
75 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#! /bin/bash | ||
AUTH="$1" | ||
EMAIL="$2" | ||
PASSWORD="$3" | ||
|
||
cd $HOME/SUSI.AI/susi_linux | ||
sudo python3 authentication.py $AUTH $EMAIL $PASSWORD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
""" Authentication Generator script for Susi Hardware. Run this script and input options | ||
to generate a file for using SUSI in authenticated mode | ||
To run this file use python3 authentication.py <choice_to_be authenticated> <email> <password> | ||
""" | ||
import json_config | ||
import sys | ||
|
||
config = json_config.connect('config.json') | ||
|
||
def authenticating(): | ||
"""Method for setting authentication parameters in the configuration | ||
:return: None | ||
""" | ||
try: | ||
# choice = input('Do you wish to use SUSI in Authenticated Mode? (y/n)\n') | ||
choice = sys.argv[1] | ||
print(choice) | ||
if choice == 'y': | ||
# email = input('Enter SUSI Sign-in Email Address: ') | ||
email = sys.argv[2] | ||
print(email) | ||
# password = input('Enter SUSI Sign-in Password: ') | ||
password = sys.argv[3] | ||
config['usage_mode'] = 'authenticated' | ||
config['login_credentials']['email'] = email | ||
config['login_credentials']['password'] = password | ||
elif choice == 'n': | ||
print('Setting anonymous mode as default') | ||
config['usage_mode'] = 'anonymous' | ||
else: | ||
raise ValueError | ||
except ValueError: | ||
print('Invalid choice. Anonymous mode set as default. Run the configuration script again if you wish ' | ||
'to change your choice.') | ||
config['usage_mode'] = 'anonymous' | ||
|
||
print("Authenticating \n") | ||
authenticating() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters