summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2013-07-11 18:03:57 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2013-07-11 18:03:57 +0200
commite9981f2d7c4223ee0a6d6426c4c420ea3613697a (patch)
treebbdae254f57c1d0aabe7cac6deaba2e2e954961e /addons/web/static/src
parentee6f6e45db723fa0384586b7b2abb17090e93283 (diff)
parenta0a05454aa2e04c7b66425c40c3812890fc35458 (diff)
[IMP] Important changes to the OpenERPSession server-side class and the way the web client handles sessions. Mostly:
* The OpenERPSession class now extends the werkzeug's session class, and is now the only class used to handle sessions * Now only one cookie is used to identify the session: session_id . It is also possible to specify the id by adding the http parameter session_id (the http parameter has higher priority than the cookie). bzr revid: nicolas.vanhoren@openerp.com-20130711160357-38tb26zf5dfp1jlv
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/chrome.js2
-rw-r--r--addons/web/static/src/js/corelib.js15
-rw-r--r--addons/web/static/src/js/coresetup.js5
3 files changed, 6 insertions, 16 deletions
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index 0c73a9b8a3c..1c976cb619e 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -1599,7 +1599,7 @@ instance.web.EmbeddedClient = instance.web.Client.extend({
if (s.session_is_valid() && s.db === this.dbname && s.login === this.login) {
return $.when();
}
- return instance.session.session_authenticate(this.dbname, this.login, this.key, true);
+ return instance.session.session_authenticate(this.dbname, this.login, this.key);
},
bind_credentials: function(dbname, login, key) {
diff --git a/addons/web/static/src/js/corelib.js b/addons/web/static/src/js/corelib.js
index 116ddf2e8c2..007a0adc803 100644
--- a/addons/web/static/src/js/corelib.js
+++ b/addons/web/static/src/js/corelib.js
@@ -1000,8 +1000,6 @@ instance.web.JsonRPC = instance.web.Class.extend(instance.web.PropertiesMixin, {
context: this.user_context || {}
});
// Construct a JSON-RPC2 request, method is currently unused
- if (this.debug)
- params.debug = 1;
var payload = {
jsonrpc: '2.0',
method: 'call',
@@ -1011,7 +1009,8 @@ instance.web.JsonRPC = instance.web.Class.extend(instance.web.PropertiesMixin, {
var deferred = $.Deferred();
if (! options.shadow)
this.trigger('request', url, payload);
-
+ payload.debug = this.debug ? true : false;
+
this.rpc_function(url, payload).then(
function (response, textStatus, jqXHR) {
if (! options.shadow)
@@ -1068,13 +1067,12 @@ instance.web.JsonRPC = instance.web.Class.extend(instance.web.PropertiesMixin, {
var data = {
session_id: this.session_id,
id: payload.id,
- sid: this.httpsessionid,
};
var set_sid = function (response, textStatus, jqXHR) {
// If response give us the http session id, we store it for next requests...
- if (response.httpsessionid) {
- self.httpsessionid = response.httpsessionid;
+ if (response.session_id) {
+ self.session_id = response.session_id;
}
};
@@ -1090,7 +1088,7 @@ instance.web.JsonRPC = instance.web.Class.extend(instance.web.PropertiesMixin, {
ajax.async = false;
var payload_str = JSON.stringify(payload);
var payload_url = $.param({r:payload_str});
- if(payload_url.length < 2000) {
+ if (payload_url.length < 2000) {
// Direct jsonp request
ajax.data.r = payload_str;
return $.ajax(ajax).done(set_sid);
@@ -1139,9 +1137,6 @@ instance.web.JsonRPC = instance.web.Class.extend(instance.web.PropertiesMixin, {
var qs = '';
if (!_.isNull(params)) {
params = _.extend(params || {}, {session_id: this.session_id});
- if (this.httpsessionid) {
- params.sid = this.httpsessionid;
- }
qs = '?' + $.param(params);
}
var prefix = _.any(['http://', 'https://', '//'], _.bind(_.str.startsWith, null, path)) ? '' : this.prefix;
diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js
index 7d37dc2261d..f153d3ad73a 100644
--- a/addons/web/static/src/js/coresetup.js
+++ b/addons/web/static/src/js/coresetup.js
@@ -23,7 +23,6 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
this.qweb_mutex = new $.Mutex();
},
rpc: function(url, params, options) {
- params.session_id = this.session_id;
return this._super(url, params, options);
},
/**
@@ -107,14 +106,10 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
return $.Deferred().reject();
}
_.extend(self, result);
- if (!_volatile) {
- self.set_cookie('session_id', self.session_id);
- }
return self.load_modules();
});
},
session_logout: function() {
- this.set_cookie('session_id', '');
$.bbq.removeState();
return this.rpc("/web/session/destroy", {});
},