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
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.2.2 on 2025-10-03 16:39

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('user', '0006_remove_old_login_accounts'),
]

operations = [
migrations.AddField(
model_name='user',
name='security_consent_version',
field=models.CharField(blank=True, null=True),
),
]
1 change: 1 addition & 0 deletions django-backend/fecfiler/user/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class User(AbstractUser):
groups = None
user_permissions = None
security_consent_exp_date = models.DateField(null=True, blank=True)
security_consent_version = models.CharField(null=True, blank=True)

objects = UserManager()

Expand Down
1 change: 1 addition & 0 deletions django-backend/fecfiler/user/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Meta:
"last_name",
"email",
"consent_for_one_year",
"security_consent_version"
]
read_only_fields = ["email", "security_consented"]

Expand Down
4 changes: 4 additions & 0 deletions django-backend/fecfiler/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def update_current(self, request):
days=365
)
else:
# If the user did not consent for one year,
# we need to clear the expiration date
if consent_for_one_year is False:
additional_data["security_consent_exp_date"] = None
request.session[session_security_consented_key] = True
serializer.save(**additional_data)
return Response(serializer.data)
Expand Down