[FIX] web: correct cookie parsing.
avoid reading wrong cookie by matching the whole cookie name bzr revid: chs@openerp.com-20131107143212-50hrpvkaw3gxxlop
This commit is contained in:
@@ -1209,15 +1209,14 @@ openerp.TranslationDataBase = openerp.Class.extend(/** @lends instance.Translati
|
||||
openerp._t = new openerp.TranslationDataBase().build_translation_function();
|
||||
|
||||
openerp.get_cookie = function(c_name) {
|
||||
if (document.cookie.length > 0) {
|
||||
var c_start = document.cookie.indexOf(c_name + "=");
|
||||
if (c_start != -1) {
|
||||
c_start = c_start + c_name.length + 1;
|
||||
var c_end = document.cookie.indexOf(";", c_start);
|
||||
if (c_end == -1) {
|
||||
c_end = document.cookie.length;
|
||||
}
|
||||
return unescape(document.cookie.substring(c_start, c_end));
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
for (var i = 0, l = cookies.length; i < l; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var name = parts.shift();
|
||||
var cookie = parts.join('=');
|
||||
|
||||
if (c_name && c_name === name) {
|
||||
return cookie;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
||||
Reference in New Issue
Block a user