Commit 46a1194c authored by Piotr Gawron's avatar Piotr Gawron
Browse files

workaround for FF Private Window mode when cookies are preserved and localStorage is not

parent 93db78e9
Pipeline #12974 failed with stage
in 10 minutes and 31 seconds
minerva (14.0.0~beta.0) unstable; urgency=low
* Bug fix: work on FF Private Window mode could cause logout or raise an
error on when opening new tab with minerva (#892)
* Bug fix: fetching list of miRnas resulted sometimes in "Internal Server
Error" (#889)
* Bug fix: user without admin right can accept terms of service (#893)
......
......@@ -182,7 +182,16 @@ ServerConnector.sendGetRequest = function (url, description) {
ServerConnector.isSessionValid = function () {
var self = this;
return self._sendRequest({method: "GET", url: this.isSessionValidUrl()}).then(function (content) {
return JSON.parse(content).login === self.getSessionData(null).getLogin();
var sessionLogin = self.getSessionData(null).getLogin();
var serverSideLogin = JSON.parse(content).login;
//this is workaround for the problem with Firefox Private Window issue
//in FF new tab is opened with existing cookies but localStorage is cleared
if (sessionLogin === undefined || sessionLogin === null) {
console.log("SET USER");
self.getSessionData(null).setLogin(serverSideLogin);
}
return serverSideLogin === self.getSessionData(null).getLogin();
}).catch(function (error) {
if (error instanceof NetworkError) {
if (error.statusCode === HttpStatus.FORBIDDEN || error.statusCode === HttpStatus.UNAUTHORIZED) {
......
......@@ -2,7 +2,6 @@
/* exported logger */
var Point = require('./map/canvas/Point');
var SessionObjectType = require('./SessionObjectType');
// noinspection JSUnusedLocalSymbols
......@@ -307,7 +306,7 @@ SessionData.prototype.setLogin = function (login) {
/**
*
* @returns {string}
* @returns {?null|string}
*/
SessionData.prototype.getLogin = function () {
var key = SessionObjectType.LOGIN;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment