Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/core/grade_notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
redacted_print_err = None
client = None
state = None
__unsafe = False

'''
Sends a text message via Twilio
Expand Down Expand Up @@ -247,7 +248,9 @@ def start_notifier():

cursor.execute(f'UPDATE Users SET lastUpdated = NOW() WHERE id={__id};')

decrypted_password = decrypt(encrypted_password, '../../private/keys/private.pem')
decrypted_password = if (__unsafe) encrypted_password \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong order, its:
encrypted_password if __unsafe else: decrypt....

else decrypt(encrypted_password, '../../private/keys/private.pem')

api = CUNYFirstAPI(username, decrypted_password, school.upper())
api.login()

Expand Down Expand Up @@ -285,20 +288,21 @@ def parse():
parser = argparse.ArgumentParser(
description='Specify commands for CUNY Grade Notifier Retriever v1.0')

parser.add_argument('--unsafe') # Development
parser.add_argument('--prod') # Production
parser.add_argument('--enable_phone') # Development
parser.add_argument('--enable_phone')
return parser.parse_args()

def initialize_twilio():
global client
client = Client(account_sid, auth_token)

def main():
global state
global state, __unsafe

args = parse()
state = LoginState.determine_state(args)

__unsafe = True if args.unsafe else False #default is that its safe
try:
# Only initialize twilio in production
# or when specifically asked
Expand Down
8 changes: 6 additions & 2 deletions src/core/initializegn.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def parse():

# Development
parser.add_argument('--enable_phone')
parser.add_argument('--unsafe') # Development

return parser.parse_args()


Expand All @@ -126,8 +128,10 @@ def main():
)
return

password = decrypt(encrypted_password, '../../private/keys/private.pem')


password = if (args.unsafe) encrypted_password \
else decrypt(encrypted_password, '../../private/keys/private.pem')

api = cunyfirstapi.CUNYFirstAPI(username, password)
api.login()
if api.is_logged_in():
Expand Down