Skip to content

Commit

Permalink
Merge version 3.5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
galenguyer authored Aug 25, 2022
2 parents e4414ca + e5761dc commit 013d429
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
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

0 comments on commit 013d429

Please sign in to comment.