Skip to content

Commit

Permalink
Merge pull request #238 from ZeusWPI/fix/session_duration
Browse files Browse the repository at this point in the history
Fix session duration to 3 months
  • Loading branch information
xerbalind authored Nov 26, 2024
2 parents f2bd719 + fe8d4a7 commit ab1867d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
11 changes: 4 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ FROM python:3.12.4-slim AS compile

WORKDIR /

ADD https://git.zeus.gent/Haldis/menus/archive/master.tar.gz .

RUN mkdir menus && \
tar --directory=menus --extract --strip-components=1 --file=master.tar.gz

RUN pip install poetry

COPY pyproject.toml poetry.lock .
Expand All @@ -16,19 +11,21 @@ RUN poetry export --without-hashes --format=requirements.txt > requirements.txt

FROM python:3.12.4-slim AS build

RUN apt update -y && apt install -y build-essential curl
RUN apt update -y && apt install -y build-essential curl git
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

COPY --from=compile requirements.txt .

RUN pip install -r requirements.txt

RUN git clone https://git.zeus.gent/Haldis/menus.git menus

FROM python:3.12.4-slim AS development

WORKDIR /src

COPY --from=compile menus menus
COPY --from=build menus menus

COPY --from=build /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages

Expand Down
1 change: 1 addition & 0 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def register_plugins(app: Flask) -> Flask:
app.config.update(
SESSION_COOKIE_HTTPONLY=True,
SESSION_COOKIE_SAMESITE="Lax",
PERMANENT_SESSION_LIFETIME=3*31*24*60*60,
)

if not app.debug:
Expand Down
1 change: 1 addition & 0 deletions app/auth/zeus.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def init_oauth(app):
def login_and_redirect_user(user) -> Response:
"""Log in the user and then redirect them"""
login_user(user)
session.permanent = True
return redirect(url_for("general_bp.home"))


Expand Down
2 changes: 1 addition & 1 deletion app/config.docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Configuration:
SQLALCHEMY_TRACK_MODIFICATIONS = False
DEBUG = True
HALDIS_ADMINS = []
SECRET_KEY = "<change>"
SECRET_KEY = os.urandom(32)
SLACK_WEBHOOK = None
LOGFILE = "haldis.log"
SENTRY_DSN = None
Expand Down
4 changes: 2 additions & 2 deletions app/config.example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""An example for a Haldis config"""

# import os
import os


class Configuration:
Expand All @@ -15,7 +15,7 @@ class Configuration:
SQLALCHEMY_TRACK_MODIFICATIONS = False
DEBUG = True
HALDIS_ADMINS = []
SECRET_KEY = "<change>"
SECRET_KEY = os.urandom(32) # Change this to a fixed, random value
SLACK_WEBHOOK = None
LOGFILE = "haldis.log"
SENTRY_DSN = None
Expand Down

0 comments on commit ab1867d

Please sign in to comment.