diff options
| author | Olivier Dony <odo@openerp.com> | 2011-12-13 17:15:54 +0100 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2011-12-13 17:15:54 +0100 |
| commit | 9835cebe195bc9ca9bffd5d4e2cba680d366b82b (patch) | |
| tree | 441881a902a8f01fea04a97d76f6bbc3b35e6669 /addons/web/static/src | |
| parent | 020c0927e43b55f897fb4a990db4db051c8a55d3 (diff) | |
| parent | 5ea774f883f1ac71ca98906a5ec5811b7e55e132 (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/static/src')
| -rw-r--r-- | addons/web/static/src/js/chrome.js | 2 | ||||
| -rw-r--r-- | addons/web/static/src/js/core.js | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 87b19b98950..f737d8eb92a 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -602,7 +602,7 @@ openerp.web.Login = openerp.web.Widget.extend(/** @lends openerp.web.Login# */{ */ do_login: function (db, login, password) { var self = this; - this.session.session_login(db, login, password, function() { + this.session.session_authenticate(db, login, password, function() { if(self.session.session_is_valid()) { if (self.has_local_storage) { if(self.remember_credentials) { diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index 95d1043c3ca..d3734d29278 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -485,10 +485,11 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp. session_is_valid: function() { return this.uid; }, - session_login: function(db, login, password, success_callback) { + session_authenticate: function(db, login, password, success_callback) { var self = this; - var params = { db: db, login: login, password: password }; - return this.rpc("/web/session/login", params, function(result) { + var base_location = document.location.protocol + '//' + document.location.host; + var params = { db: db, login: login, password: password, base_location: base_location }; + return this.rpc("/web/session/authenticate", params, function(result) { _.extend(self, { session_id: result.session_id, uid: result.uid, @@ -501,7 +502,7 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp. return true; }).then(success_callback); }, - login: function() { this.session_login.apply(this, arguments); }, + login: function() { this.session_authenticate.apply(this, arguments); }, /** * Reloads uid and session_id from local storage, if they exist */ |
