Skip to content
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ dump*
prod-migrations/
*.tar
.vscode
test.zip
test.zip
.vs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
</button>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(){
if (window.location.toString().includes("isLogin=1")) document.querySelector("#change-notice-btn").click();
// Popup hook disabled: keep the flag for future use, but do not auto-open the modal.
if (window.location.toString().includes("isLogin=1")) {
// document.querySelector("#change-notice-btn").click();
}
});
</script>
<div class="modal" id="change-notice" role="dialog">
Expand Down Expand Up @@ -48,4 +51,4 @@ <h4 class="m-5 text-center ">Notice</h4>
</div>
</div>
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions qmra/risk_assessment/templates/risk-assessment-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ <h4 class="mt-3 mx-5 text-center">Comparison of infection risk</h4>
</div>
</div>
</div>
{# Popup hook: this include is what opens the post-login notice modal. #}
{% include "default-changes-notification.html" %}

<div class="row">
<div class="col my-3">
<div id="textIntroduction"></div>
Expand Down Expand Up @@ -304,4 +304,4 @@ <h5>Enhanced Features for Registered Users</h5>
{% endblock %}

{% block side-list %}
{% endblock %}
{% endblock %}
19 changes: 18 additions & 1 deletion qmra/user/tests.py
Original file line number Diff line number Diff line change
@@ -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",
Comment thread
yaniv-kwb marked this conversation as resolved.
fetch_redirect_response=False,
)
1 change: 1 addition & 0 deletions qmra/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading