[IMP] /web/login redirects if already logged in and redirect is present in request.params
bzr revid: fme@openerp.com-20140319153345-n2u9zfovts89a340
This commit is contained in:
commit
0ce08c6f20
|
@ -141,7 +141,12 @@ def ensure_db(redirect='/web/database/selector'):
|
|||
# Thus, we redirect the user to the same page but with the session cookie set.
|
||||
# This will force using the database route dispatcher...
|
||||
r = request.httprequest
|
||||
response = werkzeug.utils.redirect(r.url, 302)
|
||||
url_redirect = r.base_url
|
||||
if r.query_string:
|
||||
# Can't use werkzeug.wrappers.BaseRequest.url with encoded hashes:
|
||||
# https://github.com/amigrave/werkzeug/commit/b4a62433f2f7678c234cdcac6247a869f90a7eb7
|
||||
url_redirect += '?' + r.query_string
|
||||
response = werkzeug.utils.redirect(url_redirect, 302)
|
||||
request.session.db = db
|
||||
response = r.app.get_response(r, response, explicit_session=False)
|
||||
werkzeug.exceptions.abort(response)
|
||||
|
@ -658,6 +663,9 @@ class Home(http.Controller):
|
|||
def web_login(self, redirect=None, **kw):
|
||||
ensure_db()
|
||||
|
||||
if request.httprequest.method == 'GET' and redirect and request.session.uid:
|
||||
return http.redirect_with_hash(redirect)
|
||||
|
||||
values = request.params.copy()
|
||||
if not redirect:
|
||||
redirect = '/web?' + request.httprequest.query_string
|
||||
|
|
Loading…
Reference in New Issue