summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorDavid Lu <david.lu@hotmail.com>2016-06-06 10:52:57 -0700
committerHarrison Healey <harrisonmhealey@gmail.com>2016-06-06 13:52:57 -0400
commit26ec73d5d215f37bb0446f4721ccfea3c9f56f89 (patch)
tree082ce6b460bb6467ee306c55d2056b88d4499db7 /webapp
parent1e245f19c7884e293698fe2e8cd7f46d4dac54c9 (diff)
downloadchat-26ec73d5d215f37bb0446f4721ccfea3c9f56f89.tar.gz
chat-26ec73d5d215f37bb0446f4721ccfea3c9f56f89.tar.bz2
chat-26ec73d5d215f37bb0446f4721ccfea3c9f56f89.zip
Added error when both session and local storage are unusable (#3263)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/i18n/en.json5
-rw-r--r--webapp/root.jsx2
-rw-r--r--webapp/stores/browser_store.jsx23
3 files changed, 23 insertions, 7 deletions
diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json
index 0657b3f8c..01efd6ab0 100644
--- a/webapp/i18n/en.json
+++ b/webapp/i18n/en.json
@@ -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 ",
diff --git a/webapp/root.jsx b/webapp/root.jsx
index 268a208a2..a96ab713b 100644
--- a/webapp/root.jsx
+++ b/webapp/root.jsx
@@ -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')
};
diff --git a/webapp/stores/browser_store.jsx b/webapp/stores/browser_store.jsx
index 11fe50928..6be2dc8f3 100644
--- a/webapp/stores/browser_store.jsx
+++ b/webapp/stores/browser_store.jsx
@@ -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;
}
}