[IMP] cookies: when retrieving session cookie, catch eventual parsing errors and remove cookie if incorrect (opw 605648)
In case of unparsable cookie (modified, corrupted,...), openerp would not load and crash with white screen until expiration. With the fix goes back to login screen. bzr revid: mat@openerp.com-20140327120826-2p6ebnojtmdl1wpm
This commit is contained in:
commit
64ecfa40ec
|
@ -125,7 +125,12 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
|
|||
for(var i=0; i<cookies.length; ++i) {
|
||||
var cookie = cookies[i].replace(/^\s*/, '');
|
||||
if(cookie.indexOf(nameEQ) === 0) {
|
||||
return JSON.parse(decodeURIComponent(cookie.substring(nameEQ.length)));
|
||||
try {
|
||||
return JSON.parse(decodeURIComponent(cookie.substring(nameEQ.length)));
|
||||
} catch (err) {
|
||||
// wrong cookie, delete it
|
||||
this.set_cookie(name, '', -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue