Added error when both session and local storage are unusable (#3263)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
1e245f19c7
Коммит
26ec73d5d2
@@ -844,6 +844,11 @@
|
||||
"error_bar.expiring": "The Enterprise license is expiring on {date}. To renew your license, please contact commercial@mattermost.com",
|
||||
"error_bar.past_grace": "Enterprise license has expired, please contact your System Administrator for details",
|
||||
"error_bar.preview_mode": "Preview Mode: Email notifications have not been configured",
|
||||
"error.not_found.title": "Page not found",
|
||||
"error.not_found.message": "The page you were trying to reach does not exist",
|
||||
"error.not_found.link_message": "Back to Mattermost",
|
||||
"error.not_supported.title": "Browser not supported",
|
||||
"error.not_supported.message": "Private browsing is not supported",
|
||||
"file_attachment.download": "Download",
|
||||
"file_info_preview.size": "Size ",
|
||||
"file_info_preview.type": "File type ",
|
||||
|
||||
@@ -99,7 +99,7 @@ import * as I18n from 'i18n/i18n.jsx';
|
||||
|
||||
const notFoundParams = {
|
||||
title: Utils.localizeMessage('error.not_found.title', 'Page not found'),
|
||||
message: Utils.localizeMessage('error.not_found.message', 'The page you where trying to reach does not exist'),
|
||||
message: Utils.localizeMessage('error.not_found.message', 'The page you were trying to reach does not exist'),
|
||||
link: '/',
|
||||
linkmessage: Utils.localizeMessage('error.not_found.link_message', 'Back to Mattermost')
|
||||
};
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import {generateId} from 'utils/utils.jsx';
|
||||
import {browserHistory} from 'react-router';
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
|
||||
const notSupportedParams = {
|
||||
title: Utils.localizeMessage('error.not_supported.title', 'Browser not supported'),
|
||||
message: Utils.localizeMessage('error.not_supported.message', 'Private browsing is not supported')
|
||||
};
|
||||
|
||||
function getPrefix() {
|
||||
if (global.window.mm_current_user_id) {
|
||||
@@ -100,7 +106,7 @@ class BrowserStoreClass {
|
||||
signalLogout() {
|
||||
if (this.isLocalStorageSupported()) {
|
||||
// PLT-1285 store an identifier in session storage so we can catch if the logout came from this tab on IE11
|
||||
const logoutId = generateId();
|
||||
const logoutId = Utils.generateId();
|
||||
|
||||
sessionStorage.setItem('__logout__', logoutId);
|
||||
localStorage.setItem('__logout__', logoutId);
|
||||
@@ -115,7 +121,7 @@ class BrowserStoreClass {
|
||||
signalLogin() {
|
||||
if (this.isLocalStorageSupported()) {
|
||||
// PLT-1285 store an identifier in session storage so we can catch if the logout came from this tab on IE11
|
||||
const loginId = generateId();
|
||||
const loginId = Utils.generateId();
|
||||
|
||||
sessionStorage.setItem('__login__', loginId);
|
||||
localStorage.setItem('__login__', loginId);
|
||||
@@ -183,9 +189,6 @@ class BrowserStoreClass {
|
||||
}
|
||||
|
||||
try {
|
||||
sessionStorage.setItem('__testSession__', '1');
|
||||
sessionStorage.removeItem('__testSession__');
|
||||
|
||||
localStorage.setItem('__testLocal__', '1');
|
||||
if (localStorage.getItem('__testLocal__') !== '1') {
|
||||
this.checkedLocalStorageSupported = false;
|
||||
@@ -197,6 +200,14 @@ class BrowserStoreClass {
|
||||
this.checkedLocalStorageSupported = false;
|
||||
}
|
||||
|
||||
try {
|
||||
sessionStorage.setItem('__testSession__', '1');
|
||||
sessionStorage.removeItem('__testSession__');
|
||||
} catch (e) {
|
||||
// Session storage not usable, website is unusable
|
||||
browserHistory.push(window.location.origin + '/error?title=' + notSupportedParams.title + '&message=' + notSupportedParams.message);
|
||||
}
|
||||
|
||||
return this.checkedLocalStorageSupported;
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user