From 19cdc90988b5fb98d0752fc1a944a2eadc957559 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Tue, 24 Nov 2020 10:47:28 +0100 Subject: [PATCH] allow user to read privacy notice before accepting it --- smash/web/middleware.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/smash/web/middleware.py b/smash/web/middleware.py index 88bfbd50..b56147a4 100644 --- a/smash/web/middleware.py +++ b/smash/web/middleware.py @@ -22,7 +22,10 @@ class PrivacyNoticeMiddleware(MiddlewareMixin): worker = Worker.get_by_user(request.user) if worker is None: return None - if study.study_privacy_notice and study.acceptance_of_study_privacy_notice_required and not worker.privacy_notice_accepted: + if study.study_privacy_notice \ + and study.acceptance_of_study_privacy_notice_required \ + and not worker.privacy_notice_accepted\ + and study.study_privacy_notice.document.url != request.path: messages.add_message(request, messages.WARNING, "You can't use the system until you accept the privacy notice.") #return reverse_lazy('web.views.accept_privacy_notice', kwargs={'pk': study.study_privacy_notice}) return redirect(reverse('web.views.accept_privacy_notice', kwargs={'pk': study.study_privacy_notice.id})) -- GitLab