diff options
| author | Toufik Ben Jaa <tbe@odoo.com> | 2019-12-13 14:03:30 +0000 |
|---|---|---|
| committer | Toufik Ben Jaa <tbe@odoo.com> | 2020-01-06 17:38:59 +0000 |
| commit | 427e8d76a36916a5329df5a51233f12715b64e40 (patch) | |
| tree | dfbf739c836f62a3eda742a1fe473266a0ae0ec1 /addons/web/static/src/js/views/basic/basic_controller.js | |
| parent | fd0d8770cb71ba7367e58487278c6fb0135dc405 (diff) | |
[FIX] website: avoid to instanciate `env` in request
- The module `website` instanciate the environment bound to
request before `_dispatch` is called.
This causes issues with with routes that create their own
psycopg2 cursor.
To be more precise, the issue that allowed us to discover this
instanciation is linked to the module `auth_oauth`.
The route `/auth_oauth/signin` is a `none` route that receives
a database name. It uses the db name to create a cursor and
an environment manually to process the OAuth signin, log-in the user
then assume it is safe to now use `request.env` to process the rest
of the code.
But here, since a cursor has already been created in `request` before the
route had the chance to commit its changes to `res.users`, the
changes made in the route `/auth_oauth/signin` are not available.
And this causes issues with the computation of the session token
done in the method `_compute_session_token` in the model `res.users`.
It uses the field `oauth_access_token` to compute the session token.
But since, the cursor in `request` is in a transaction that is not
yet aware of the changes made on this field, it will compute a
session token using the old `oauth_access_token` and store this
outdated token in the client's session.
Then here depending if you are using a multi-worker or a multi-thread
Odoo, you either are never signed in or your session is expired
after a cache cleaning (the method `_compute_session_token` is cached).
closes odoo/odoo#42808
X-original-commit: ceec103826ae2a18c63b48c17850d035e352fa3b
Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_controller.js')
0 files changed, 0 insertions, 0 deletions
