Skip to content

Commit

Permalink
restored changes again
Browse files Browse the repository at this point in the history
  • Loading branch information
malloc-nbytes committed Feb 10, 2025
1 parent bcd787c commit 971b988
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 48 deletions.
37 changes: 17 additions & 20 deletions AWS/syscontrol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -442,20 +442,18 @@ function serve_rubricapp() {
log "serving front-end"
cd "$PROJ_DIR/FrontEndReact"

npm run build

# if [ "$environment" = "prod" ];
# then
# log "serving production build for frontend"
# npm run build
# elif [ "$environment" = "dev" ];
# then
# log "serving development build for frontend"
# # npm run dev
# npm run start
# else
# panic "serve takes either 'prod' or 'dev'"
# fi
if [ "$environment" = "prod" ];
then
log "serving production build for frontend"
npm run build
elif [ "$environment" = "dev" ];
then
log "serving development build for frontend"
# npm run dev
npm run start
else
panic "serve takes either 'prod' or 'dev'"
fi

serve -s -l tcp://0.0.0.0:3000 build &
cd -
Expand Down Expand Up @@ -534,12 +532,11 @@ case "$1" in
configure
;;
"$SERVE")
# if [ "$#" -lt 2 ];
# then
# panic "missing <dev/prod> for serving"
# exit 1
# fi
# serve_rubricapp "$2"
if [ "$#" -lt 2 ];
then
panic "missing <dev/prod> for serving"
exit 1
fi
serve_rubricapp "$2"
;;
"$UPDATE")
Expand Down
19 changes: 7 additions & 12 deletions BackEndFlask/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,13 @@ def setup_cron_jobs():
red = redis.Redis(host=redis_host, port=6379, db=0, decode_responses=True)

# Initialize Gmail OAuth2 service
# oauth2_scopes = [
# "https://www.googleapis.com/auth/gmail.compose",
# "https://www.googleapis.com/auth/gmail.readonly",
# ]
# oauth2_token_fp = "/home/ubuntu/private/token.json"
# oauth2_credentials = get_oauth2_credentials(oauth2_token_fp, oauth2_scopes)
# oauth2_service = build("gmail", "v1", credentials=oauth2_credentials)

oauth2_scopes = None
oauth2_token_fp = None
oauth2_credentials = None
oauth2_service = None
oauth2_scopes = [
"https://www.googleapis.com/auth/gmail.compose",
"https://www.googleapis.com/auth/gmail.readonly",
]
oauth2_token_fp = "/home/ubuntu/private/token.json"
oauth2_credentials = get_oauth2_credentials(oauth2_token_fp, oauth2_scopes)
oauth2_service = build("gmail", "v1", credentials=oauth2_credentials)

# Register blueprints
from controller import bp
Expand Down
31 changes: 15 additions & 16 deletions BackEndFlask/models/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,21 @@ def email_students_feedback_is_ready_to_view(students: list, notification_messag
send_email(student.email, subject, message)

def send_email(address: str, subject: str, content: str):
return
# try:
# message = EmailMessage()
# message.set_content(content)
# message["To"] = address
# message["From"] = "[email protected]"
# message["Subject"] = subject

# encoded_message = base64.urlsafe_b64encode(message.as_bytes()).decode()
# create_message = {
# "raw": encoded_message,
# }
# send_message = oauth2_service.users().messages().send(userId="me", body=create_message).execute()

# except Exception as e:
# raise EmailFailureException(str(e))
try:
message = EmailMessage()
message.set_content(content)
message["To"] = address
message["From"] = "[email protected]"
message["Subject"] = subject

encoded_message = base64.urlsafe_b64encode(message.as_bytes()).decode()
create_message = {
"raw": encoded_message,
}
send_message = oauth2_service.users().messages().send(userId="me", body=create_message).execute()

except Exception as e:
raise EmailFailureException(str(e))


def generate_random_password(length: int):
Expand Down

0 comments on commit 971b988

Please sign in to comment.