Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit f9fed86

Browse files
committed
If access token missing, but logged in, just add one.
1 parent 054e6c8 commit f9fed86

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

controllers/assignments.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,12 @@ def doAssignment():
879879
@auth.requires_login()
880880
def chooseAssignment():
881881

882+
if "access_token" not in request.cookies:
883+
logger.error(f"Missing Access Token: {auth.user.username} adding one Now")
884+
_create_access_token(
885+
{"sub": auth.user.username}, expires=datetime.timedelta(days=30)
886+
)
887+
882888
timezoneoffset = session.timezoneoffset if "timezoneoffset" in session else None
883889
status = [] # This will be used to show the status of each assignment on html file
884890
duedates = [] # This will be used to display the due date for each assignment

controllers/default.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,12 @@ def bios():
360360

361361
@auth.requires_login()
362362
def courses():
363+
if "access_token" not in request.cookies:
364+
# The user is only partially logged in.
365+
_create_access_token(
366+
{"sub": auth.user.username}, expires=datetime.timedelta(days=30)
367+
)
368+
363369
if request.vars.requested_course:
364370
# We have a mismatch between the requested course and the current course
365371
# in the database

views/assignments/doAssignment.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,13 @@ <h5 style='text-align:center;'>Not yet graded</h5>
130130
{{if is_graded:}}
131131
<div style='background-color:powderblue; margin-left:2cm; margin-right:2cm;'>
132132
<p style='margin-left:0.5cm; margin-right:0.5cm;'>This assignment is graded and is no longer
133-
accepting submissions</p>
133+
accepting submissions. You can still do the work, but it is up to your instructor whether
134+
they will accept it or not.</p>
134135
</div>
135136
{{elif enforce_pastdue:}}
136137
<div style='background-color:powderblue; margin-left:2cm; margin-right:2cm;'>
137-
<p style='margin-left:0.5cm; margin-right:0.5cm;'>The due date has passed for this assignment
138-
and is no longer accepting submissions</p>
138+
<p style='margin-left:0.5cm; margin-right:0.5cm;'>The due date has passed for this assignment.
139+
You can no longer change your status, but your work will be recorded and time stamped</p>
139140
</div>
140141
{{pass}}
141142
{{elif is_submit == "In Progress":}}

0 commit comments

Comments
 (0)