Skip to content
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "CSH Packet",
"name": "csh-packet",
"version": "3.5.6",
"version": "3.5.7",
"description": "A web app implementation of the CSH introductory packet.",
"bugs": {
"url": "https://github.com/ComputerScienceHouse/packet/issues",
Expand Down
4 changes: 4 additions & 0 deletions packet/templates/include/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@
<li class="navbar-user dropdown">

<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" id="user01">
{% if info.realm == "csh" %}
<img src="https://profiles.csh.rit.edu/image/{{ info.uid }}">
{% else %}
<img src="{{ get_rit_image(info.uid) }}">
{% endif %}
{{ info.uid }}
<span class="caret"></span>
</a>
Expand Down
13 changes: 12 additions & 1 deletion packet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
from datetime import datetime, time, timedelta, date
from functools import wraps, lru_cache
from typing import Any, Callable, TypeVar, cast
from urllib.parse import urlparse

import requests
from flask import session, redirect
from flask import session, redirect, request

from packet import auth, app, db, ldap
from packet.mail import send_start_packet_mail
Expand Down Expand Up @@ -64,6 +65,16 @@ def is_freshman_on_floor(rit_username: str) -> bool:
return False


@app.before_request
def before_reqest_callback() -> Any:
"""
Pre-request function to ensure we're on the right URL before OIDC sees anything
"""
if urlparse(request.base_url).hostname != app.config['SERVER_NAME']:
return redirect(request.base_url.replace(urlparse(request.base_url).hostname,
app.config['SERVER_NAME']), code=302)
return None

def packet_auth(func: WrappedFunc) -> WrappedFunc:
"""
Decorator for easily configuring oidc
Expand Down