diff --git a/.gitignore b/.gitignore index cd37399..9134db1 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ dump* prod-migrations/ *.tar .vscode -test.zip \ No newline at end of file +test.zip +.vs diff --git a/qmra/risk_assessment/templates/default-changes-notification.html b/qmra/risk_assessment/templates/default-changes-notification.html index 7fcf757..9c4ab98 100644 --- a/qmra/risk_assessment/templates/default-changes-notification.html +++ b/qmra/risk_assessment/templates/default-changes-notification.html @@ -4,7 +4,10 @@ - \ No newline at end of file + diff --git a/qmra/risk_assessment/templates/risk-assessment-list.html b/qmra/risk_assessment/templates/risk-assessment-list.html index e86ebcd..ed96df1 100644 --- a/qmra/risk_assessment/templates/risk-assessment-list.html +++ b/qmra/risk_assessment/templates/risk-assessment-list.html @@ -32,8 +32,8 @@

Comparison of infection risk

+ {# Popup hook: this include is what opens the post-login notice modal. #} {% include "default-changes-notification.html" %} -
@@ -304,4 +304,4 @@
Enhanced Features for Registered Users
{% endblock %} {% block side-list %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/qmra/user/tests.py b/qmra/user/tests.py index 7ce503c..3d66891 100644 --- a/qmra/user/tests.py +++ b/qmra/user/tests.py @@ -1,3 +1,20 @@ from django.test import TestCase +from django.urls import reverse -# Create your tests here. +from qmra.user.models import User + + +class TestLoginView(TestCase): + def test_successful_login_redirects_with_notice_flag(self): + User.objects.create_user("test-user", "test-user@example.com", "password") + + response = self.client.post( + reverse("login"), + {"username": "test-user", "password": "password"}, + ) + + self.assertRedirects( + response, + f"{reverse('index')}?isLogin=1", + fetch_redirect_response=False, + ) diff --git a/qmra/user/views.py b/qmra/user/views.py index e6e5f3c..89b1247 100644 --- a/qmra/user/views.py +++ b/qmra/user/views.py @@ -51,6 +51,7 @@ def login_view(request): # Check if authentication successful if user is not None: login(request, user) + # Popup hook: this query flag triggers the post-login notice modal. return HttpResponseRedirect(f"{reverse('index')}?isLogin=1") else: return render(