Commit Graph
81 Commits
Author SHA1 Message Date
Jeremy Kersten 478068c829 [IMP] *: always use Odoo Response
This branch adds request.redirect on all requests.
In case of a front end request, we do an url_for to the location.

We removed redirect_with_hash that was only for retro compatibility

local_redirect has been renamed to redirect_query, and param keep_hash has been
removed and moved.

Default code for redirect is 303 now instead of 302.

Now redirect and redirect_query make local redirect by default, you need to
pass local=False to make external redirect.

All werkeug.utils.redirect has been replaced by request.redirect.

Http.redirect now use an http.Response type, and it become easy to add an
override like 'set_cookies' e.g.

Dispatch of a website.page return an http.response too, so we first need to
check if it is a cached version before to check if it is an Odoo Response.

Migrate your code:

http.redirect -> request.redirect(location, code, local)
http.local_redirect -> request.redirect_query(location, query, code, local)
http.redirect_with_hash -> request.redirect

Courtesy of odony for help and review ;)

closes odoo/odoo#72599

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-07-08 07:00:06 +00:00
Xavier Morel de590816d8 [FIX] *: deprecated access to url_ utilities through werkzeug root
In 0.15 accessing werkzeug.urls functions directly through werkzeug
is deprecated, the shortcut will be removed in the eventual werkzeug
1.0.

Fix existing uses of these shortcuts. Also cleanup some imports when
they're not far from a werkzeug* import being altered.
2020-02-04 12:42:35 +00:00
Christophe Simonis d61873ac4a [MERGE] forward port branch saas-15 up to 10d88083a0 2019-08-29 13:37:39 +02:00
Jairo Llopis 7c99310b23 [FIX] auth_oauth: Override qcontext in the right place
Before this patch, if some module was based on top of `auth_signup`, and `auth_oauth` was also installed in the same database, the only way to get the proper qcontext would be to call `super()` inside `web_auth_signup_qcontext`, which would produce a login, which is most likely not desired because such addon would try to add some logic on top of it that maybe prevents login based on some circumstances.

After this patch, any submodules can work properly without workarounds.

closes odoo/odoo#34690

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-07-09 11:31:25 +00:00
Christophe Simonis e354142ce7 [MERGE] forward port branch saas-15 up to c22e479246 2018-07-10 13:21:06 +02:00
Christophe Simonis 5e682451cb [MERGE] forward port branch 9.0 up to 8b25099aea 2018-07-10 11:25:27 +02:00
Andreas Perhab 8b25099aea [FIX] auth_oauth: validate db against db_filter 2018-07-09 18:55:11 +02:00
Christophe Simonis 5ea0f55d65 [MERGE] forward port branch saas-15 up to bee0c11ef7 2017-10-20 17:57:21 +02:00
Christophe Simonis e2532f855f [MERGE] forward port branch 9.0 up to 31c1be1fac 2017-10-20 16:02:12 +02:00
rde 31c1be1fac [IMP] auth_oauth: prevent portal users to land on /web after login
Before this commit, a portal user would land on /web after login in with oauth.
He would then just see the "Website" app.
He should then click on it to land on website instead of landing directly on it
after login in, which is not convenient, especially since theses users doesn't
know Odoo (in case of sale customers manually created for instance).

Now, if users has no 'base.group_user' right, it will be redirected to the
website directly instead of /web.
2017-10-20 15:25:28 +02:00
Xavier Morel 3979f6802e [#8530] convert exception handlers to except..as syntax
Futurize fixers:
* lib2to3.fixes.fix_except
2017-04-11 14:53:29 +02:00
jaredkipe 4b500aa298 [FIX] auth_oauth: remove redirect if there is only 1 provider
Forcing the redirection for 1 provider but not for 2 makes no sense.
Was done at 311f041f for the reset password, applied to signup too.

Closes #15032
2017-01-16 13:49:59 +01:00
Christophe Simonis 1a77d9d02a [MERGE] forward port branch saas-12 up to 476cb5a0 2016-09-03 23:57:57 +02:00
Denis Ledoux 311f041f7f [FIX] auth_oauth: pass reset, remove auto redirect when only one provider
Even if there is only one provider,
you could still use the internal login rather than
this oauth provider to sign in,
and therefore you need to remain on the regular
login page if you would like to reset your internal password
2016-08-29 11:46:35 +02:00
Kinjal Mehta 3f201066f0 [MIG]auth_oauth: Migrate to new api. 2016-08-02 16:02:29 +02:00
Christophe Simonis 521b90a8da [MERGE] forward port of branch saas-6 up to 12d7996 2015-12-08 15:17:06 +01:00
Christophe Simonis 12d799623c [MERGE] forward port of branch 8.0 up to 83a4a58 2015-12-08 13:03:08 +01:00
Christophe Simonis 83a4a582fa [MERGE] forward port of branch saas-3 up to 513cea6 2015-12-08 12:28:41 +01:00
Christophe Simonis 513cea69c6 [FIX] auth_oauth: do not transfer debug flag to OAuth provider
This parameter is not part of the spec [1] and may not be supported by
all OAuth providers.

[1] http://tools.ietf.org/html/rfc6749#section-4.2.1
2015-12-08 12:16:42 +01:00
Leonardo Rochael Almeida 60af7cac02 [IMP] replace simplejson with stdlib json
The stdlib version of the json library is more recent than the 3.5.3
version we are pinning in `requirements.txt`

There is no reason to use it.

Closes #6940
2015-09-28 10:53:32 +02:00
Richard Mathot 03d71ad88c [REM] auth_oauth: remove legacy code
The forwardport has been done and these fields are required, so we can
safely shorten the domain.
2015-03-31 09:34:19 +02:00
Christophe Simonis 18e22be138 [MERGE] forward port of branch 8.0 up to 0aab81c 2015-01-19 17:15:56 +01:00
Denis Ledoux 36a6876980 [FIX] auth_oauth: avoid double slashed redirect urls 2015-01-12 12:02:06 +01:00
Christophe Simonis fab4d6d442 [MERGE] forward port of branch 8.0 up to ea54d4a 2015-01-06 11:49:04 +01:00
Leonardo Donelli 4a0b13ed92 [REF] remove vim modelines and resulting trailing blank lines
Let 2015 be a year without modelines!
cf #4174
2014-12-31 15:52:13 +01:00
Christophe Simonis 68134d38a3 [FIX] auth_oauth: ignore "debug" argument when converting fragment to query string 2014-12-12 15:11:08 +01:00
rlu-odoo 8b67a7202d [REF] OpenERP --> Odoo in various UI texts
Rebranding has been done in:
- data/demo files
- html templates
- help notices
- comments
- logger messages
- and other various messages

(Commit taken from odoo-dev:8.0-improve-openerp-odoo-rlu at rev 7deaa08)

Closes #1260
2014-07-18 13:45:41 +02:00
Olivier Dony d9cda97cf4 [MERGE] Forward-port saas-4 up to 5ceded9 2014-07-05 01:28:19 +02:00
Olivier Dony 5ceded9d69 [MERGE] Forward-port saas-3 up to 4fa30f5 2014-07-05 01:04:19 +02:00
Richard Mathot 376cdf36b4 [FIX] auth_oauth: prevent crash on login screen
Empty URLs for OAuth providers do not crash anymore the login screen
2014-07-02 13:56:11 +02:00
Christophe Simonis adf07a9490 [MERGE] forward port of branch saas-4 up to 5087612 2014-06-19 16:13:35 +02:00
Christophe Simonis 5087612d1d [MERGE] forward port of branch saas-3 up to bf53aed 2014-06-19 15:44:07 +02:00
Denis Ledoux b587038570 [FIX] auth_oauth: url_unquote_plus does not handle boolean
If the redirect param 'r' is not in the state, do no try to unquote it
2014-06-17 09:26:20 +02:00
Denis Ledoux a3cfe1728d [FIX] auth_oauth: unquote redirect url from state
This is related to 2db6a0080f. Looks like Firefox auto unquote, but not Chrome
2014-06-16 22:52:50 +02:00
Denis Ledoux 2db6a0080f [FIX] auth_oauth: quote redirect url in state
Otherwise, Firefox is splitting the state at the first &, which can potentially be located in the redict param of the state
2014-06-16 22:40:31 +02:00
Denis Ledoux 0a537dae91 [FIX] auth_oauth: missing res_users.py diff from rev 33bfec2174
Most probably due to github migration
+  fix: directly redirect to login redirect paramas, instead of redirecting on the complete  web/login + redirect url
2014-06-02 18:47:41 +02:00
Christophe Simonis 8ac408f70e [FIX] auth_oauth: controller need to inherit from auth_signup controller 2014-06-02 15:17:58 +02:00
Christophe Simonis 3a7e003656 [MERGE] forward port of branch saas-3 up to revid 9394 chs@openerp.com-20140410103638-x7vajn70ewsfp0ck
bzr revid: chs@openerp.com-20140410110424-enhdg6pufhii56ni
2014-04-10 13:04:24 +02:00
Denis Ledoux ff76882701 [FIX] auth_oauth: avoid infinite loop while trying to sign in
bzr revid: dle@openerp.com-20140407155919-vm32q6nvcit59026
2014-04-07 17:59:19 +02:00
Denis Ledoux 6027657e3e [FIX] auth_oauth: redirect to url before sign in
bzr revid: dle@openerp.com-20140407150027-z46yxuh3a9uqoz26
2014-04-07 17:00:27 +02:00
Christophe Simonis d93b79e6f4 [MERGE] forward port of branch saas-3 up to revid 9345 dle@openerp.com-20140324110349-e82t1bmmtjqbl85k
bzr revid: chs@openerp.com-20140324133811-4az1kvbznd26seow
2014-03-24 14:38:11 +01:00
Fabien Meghazi a8f513f4f2 [MERGE] upstream
bzr revid: fme@openerp.com-20140312152942-egbzui0drs85wt7i
2014-03-12 16:29:42 +01:00
Fabien Meghazi 2ed053642a [IMP] oaut & signup, redirect if already logged in
bzr revid: fme@openerp.com-20140312112141-uvo89w4ovmzq5ozq
2014-03-12 12:21:41 +01:00
Christophe Simonis d504764eff [MERGE] forward port of branch saas-3 up to revid 9298 chm@openerp.com-20140311130852-3ft0v1mc9ht1any6
bzr revid: chs@openerp.com-20140311145205-s56fj113fsrnisc3
2014-03-11 15:52:05 +01:00
Kersten Jeremy 590b50f548 [FIX] Compare the real pathname with the new url and not the object windows.location
bzr revid: jke@openerp.com-20140305164321-xw05yeun302rizm4
2014-03-05 17:43:21 +01:00
Fabien Meghazi 312991ca1e [FIX] ensure_db() on inherited /web/login controllers
bzr revid: fme@openerp.com-20140227164141-1sblr0g6ta66q1em
2014-02-27 17:41:41 +01:00
Fabien Meghazi 152e70e9fa [IMP] seperation of auth_signup's reset password and signup routes
bzr revid: fme@openerp.com-20140227154955-tnxyzw1ynuwlo5mj
2014-02-27 16:49:55 +01:00
Kersten Jeremy 49a92c376a [FIX] Fix loop when parse hash into get param with no hash
bzr revid: jke@openerp.com-20140227130705-jlvl157aio3o4df3
2014-02-27 14:07:05 +01:00
Fabien Meghazi 2868e9a6ac [MERGE] upstream
bzr revid: fme@openerp.com-20140227101725-7egd9xq859jasnhj
2014-02-27 11:17:25 +01:00
Fabien Meghazi 35a7182893 [MERGE] upstream
bzr revid: fme@openerp.com-20140225104654-d1ni7z5t8w0qc7mw
2014-02-25 11:46:54 +01:00