summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2017-01-10 17:02:39 +0100
committerOlivier Dony <odo@openerp.com>2017-01-10 17:09:03 +0100
commitcd4ff9341e8a1bf9ca383b43facba573204f9fa1 (patch)
tree4662798a1b5cb2954d0eeade4ac4cce7412feefa
parentfc813847d8cf3242a0202cff813c3466cd0a5e1f (diff)
[FIX] http: make error 400 slightly more user-friendly
Users who get an error 400 due to an invalid CSRF token might be doing something legit. For example they may have opened the page with the HTTP form 2 hours before posting it, and let the CSRF token expire naturally (default lifetime is 1h). In this situation the "invalid CSRF token" message might be too cryptic for them to understand that they need to refresh the form and try again. Mentioning that their "Session expired" as well should sound more familiar and lead to the right reaction.
-rw-r--r--openerp/http.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/openerp/http.py b/openerp/http.py
index 5977b7a402d..a2364175bef 100644
--- a/openerp/http.py
+++ b/openerp/http.py
@@ -840,7 +840,7 @@ more details.
passing the `csrf=False` parameter to the `route` decorator.
""", request.httprequest.path)
- raise werkzeug.exceptions.BadRequest('Invalid CSRF Token')
+ raise werkzeug.exceptions.BadRequest('Session expired (invalid CSRF token)')
r = self._call_function(**self.params)
if not r: