summaryrefslogtreecommitdiff
path: root/addons/web/controllers
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2011-12-13 17:15:54 +0100
committerOlivier Dony <odo@openerp.com>2011-12-13 17:15:54 +0100
commit9835cebe195bc9ca9bffd5d4e2cba680d366b82b (patch)
tree441881a902a8f01fea04a97d76f6bbc3b35e6669 /addons/web/controllers
parent020c0927e43b55f897fb4a990db4db051c8a55d3 (diff)
parent5ea774f883f1ac71ca98906a5ec5811b7e55e132 (diff)
[MERGE] Use the new authenticate() API instead of login()
Using the new authenticate() API instead allows to pass a user-agent environment along with the credentials. The main use for the UA environment at this point is to pass the base URL used to login, so that the server may initialize its "web.base.url" global config parameters bzr revid: odo@openerp.com-20111213161554-jbtrp94aatcnibne
Diffstat (limited to 'addons/web/controllers')
-rw-r--r--addons/web/controllers/main.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index 397a6a0d302..81061ba5477 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -337,8 +337,16 @@ class Session(openerpweb.Controller):
_cp_path = "/web/session"
@openerpweb.jsonrequest
- def login(self, req, db, login, password):
- req.session.login(db, login, password)
+ def authenticate(self, req, db, login, password, base_location=None):
+ wsgienv = req.httprequest.environ
+ release = web.common.release
+ env = dict(
+ base_location=base_location,
+ HTTP_HOST=wsgienv['HTTP_HOST'],
+ REMOTE_ADDR=wsgienv['REMOTE_ADDR'],
+ user_agent="%s / %s" % (release.name, release.version),
+ )
+ req.session.authenticate(db, login, password, env)
ctx = req.session.get_context() if req.session._uid else {}
return {