generated from prof-rossetti/flask-sheets-template-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
beginning of adding wrappers for routes based on authenticated access
- Loading branch information
1 parent
613a86c
commit 139719d
Showing
5 changed files
with
96 additions
and
6 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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
courses_routes = Blueprint("courses_routes", __name__) | ||
|
||
from web_app.routes.wrappers import authenticated_route | ||
from web_app.routes.wrappers import authenticated_route, student_route, teacher_route | ||
|
||
@courses_routes.route("/courses/<course_id>") | ||
@authenticated_route | ||
|
@@ -15,8 +15,10 @@ def course(course_id): | |
assignments_list = ss.get_course_assignments("[email protected]", course_id) | ||
return render_template("assignments.html", assignments=assignments_list, course_id=course_id) | ||
|
||
|
||
@courses_routes.route("/courses/<course_id>/assignments/<assignment_id>") | ||
@authenticated_route | ||
@student_route | ||
def assignment(course_id, assignment_id): | ||
print(f"COURSE {course_id}: ASSIGNMENT {assignment_id}") | ||
ss = current_app.config["SPREADSHEET_SERVICE"] | ||
|
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,34 @@ | ||
{% extends "bootstrap_5_layout.html" %} | ||
{% set active_page = "user_profile" %} | ||
|
||
{% block content %} | ||
|
||
<div class="container" style="max-width: 350px;"> | ||
|
||
<h1>User Profile</h1> | ||
<div class="card card-body bg-light mt-3"> | ||
|
||
<div class="mb-3"> | ||
<label for="email-input" class="form-label">Email:</label> | ||
<input disabled type="text" name="email" id="email-input" class="form-control" value="{{ user.email }}" title="Email cannot be changed" style="cursor: not-allowed;"> | ||
</div> | ||
|
||
<div class="mb-3"> | ||
<label for="first-name-input" class="form-label">First Name:</label> | ||
<input disabled type="text" name="first_name" id="first-name-input" class="form-control" value="{{ user.given_name }}" > | ||
</div> | ||
|
||
<div class="mb-3"> | ||
<label for="last-name-input" class="form-label">Last Name:</label> | ||
<input disabled type="text" name="last_name" id="last-name-input" class="form-control" value="{{ user.family_name }}"> | ||
</div> | ||
|
||
</div> | ||
|
||
<div class="card card-body mt-3"> | ||
<p class="mt-0 mb-0"> | ||
<a href="/logout">Logout</a> | ||
</p> | ||
</div> | ||
|
||
{% endblock %} |