[FIX] survey: properly detect wrong token

Was in old API
  user_input_obj.search(...)[0]
but the tr/except was not migrated

Introduced at 66cb880
This commit is contained in:
Martin Trigaux
2018-02-13 15:56:01 +05:30
parent 169f899e29
commit ca0875231f
+2 -3
View File
@@ -109,9 +109,8 @@ class WebsiteSurvey(http.Controller):
return errpage
# Load the user_input
try:
user_input = UserInput.sudo().search([('token', '=', token)], limit=1)
except IndexError: # Invalid token
user_input = UserInput.sudo().search([('token', '=', token)], limit=1)
if not user_input: # Invalid token
return request.render("website.403")
# Do not display expired survey (even if some pages have already been