Skip to content

Commit 013d429

Browse files
authored
Merge version 3.5.7
2 parents e4414ca + e5761dc commit 013d429

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"title": "CSH Packet",
33
"name": "csh-packet",
4-
"version": "3.5.6",
4+
"version": "3.5.7",
55
"description": "A web app implementation of the CSH introductory packet.",
66
"bugs": {
77
"url": "https://github.com/ComputerScienceHouse/packet/issues",

packet/templates/include/nav.html

+4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@
4141
<li class="navbar-user dropdown">
4242

4343
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" id="user01">
44+
{% if info.realm == "csh" %}
4445
<img src="https://profiles.csh.rit.edu/image/{{ info.uid }}">
46+
{% else %}
47+
<img src="{{ get_rit_image(info.uid) }}">
48+
{% endif %}
4549
{{ info.uid }}
4650
<span class="caret"></span>
4751
</a>

packet/utils.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
from datetime import datetime, time, timedelta, date
55
from functools import wraps, lru_cache
66
from typing import Any, Callable, TypeVar, cast
7+
from urllib.parse import urlparse
78

89
import requests
9-
from flask import session, redirect
10+
from flask import session, redirect, request
1011

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

6667

68+
@app.before_request
69+
def before_reqest_callback() -> Any:
70+
"""
71+
Pre-request function to ensure we're on the right URL before OIDC sees anything
72+
"""
73+
if urlparse(request.base_url).hostname != app.config['SERVER_NAME']:
74+
return redirect(request.base_url.replace(urlparse(request.base_url).hostname,
75+
app.config['SERVER_NAME']), code=302)
76+
return None
77+
6778
def packet_auth(func: WrappedFunc) -> WrappedFunc:
6879
"""
6980
Decorator for easily configuring oidc

0 commit comments

Comments
 (0)