From 194e33db61abb7c8757ae0cd96a697def7fafa1c Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Wed, 2 Aug 2023 15:48:45 +0800 Subject: [PATCH] Fixed JWT token lifetime --- stude/config/settings.py | 8 +++++--- .../0003_alter_subject_unique_together.py | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 stude/subjects/migrations/0003_alter_subject_unique_together.py diff --git a/stude/config/settings.py b/stude/config/settings.py index a273e30..88c18ad 100644 --- a/stude/config/settings.py +++ b/stude/config/settings.py @@ -10,6 +10,7 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.2/ref/settings/ """ +from datetime import timedelta from pathlib import Path from dotenv import load_dotenv # Python dotenv import os @@ -235,9 +236,10 @@ else: SITE_NAME = 'Stud-E' -JWT_TOKEN_LIFETIME = 10800 -ACCESS_TOKEN_LIFETIME = JWT_TOKEN_LIFETIME -REFRESH_TOKEN_LIFETIME = 24 * JWT_TOKEN_LIFETIME +SIMPLE_JWT = { + "ACCESS_TOKEN_LIFETIME": timedelta(minutes=360), + "REFRESH_TOKEN_LIFETIME": timedelta(minutes=360) +} LEAFLET_CONFIG = { 'DEFAULT_CENTER': (8.48567, 124.65642), diff --git a/stude/subjects/migrations/0003_alter_subject_unique_together.py b/stude/subjects/migrations/0003_alter_subject_unique_together.py new file mode 100644 index 0000000..3951a83 --- /dev/null +++ b/stude/subjects/migrations/0003_alter_subject_unique_together.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.3 on 2023-07-28 16:53 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('courses', '0001_initial'), + ('year_levels', '0001_initial'), + ('semesters', '0001_initial'), + ('subjects', '0002_alter_subject_code'), + ] + + operations = [ + migrations.AlterUniqueTogether( + name='subject', + unique_together={('name', 'course', 'year_level', 'semester')}, + ), + ]