From 3cb6785d4b21b1c2f61b952908cbba41d31885b8 Mon Sep 17 00:00:00 2001 From: Nikunj Ladava Date: Thu, 6 Oct 2022 10:51:25 +0000 Subject: [PATCH] [IMP] survey: raise access error when user dont have access of survey MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit before this commit, once users got an invitation to fill out any survey and if they log in with another credential than the shared credentials, they will be redirected to the home page instead of a survey. after this commit, if the user tries to fill out the survey with another credential, an error will be raised that the user doesn't have access Task-2960271 closes odoo/odoo#102612 Signed-off-by: Warnon Aurélien (awa) --- addons/survey/controllers/main.py | 2 ++ .../views/survey_templates_management.xml | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/addons/survey/controllers/main.py b/addons/survey/controllers/main.py index cc275b64e9f..9c87101b040 100644 --- a/addons/survey/controllers/main.py +++ b/addons/survey/controllers/main.py @@ -151,6 +151,8 @@ class Survey(http.Controller): return request.render("survey.survey_auth_required", {'survey': survey_sudo, 'redirect_url': redirect_url}) elif error_key == 'answer_deadline' and answer_sudo.access_token: return request.render("survey.survey_closed_expired", {'survey': survey_sudo}) + elif error_key in ['answer_wrong_user', 'token_wrong']: + return request.render("survey.survey_access_error", {'survey': survey_sudo}) return request.redirect("/") diff --git a/addons/survey/views/survey_templates_management.xml b/addons/survey/views/survey_templates_management.xml index 6714149c720..30e58d7a6a2 100644 --- a/addons/survey/views/survey_templates_management.xml +++ b/addons/survey/views/survey_templates_management.xml @@ -73,6 +73,24 @@ + + +