From c869613fb983b5c94eb77a8c8ead99a048f7dd84 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Wed, 19 Oct 2011 23:49:43 +0000 Subject: [PATCH] Adding error message for unauthenticated access. --- gemp-lotr/gemp-lotr-web/src/main/webapp/js/chat.js | 6 ++++++ gemp-lotr/gemp-lotr-web/src/main/webapp/js/hallUi.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/chat.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/chat.js index 1a998c5d9..b8879d190 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/chat.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/chat.js @@ -15,6 +15,12 @@ var ChatBoxUI = Class.extend({ this.div = div; this.communication = new GempLotrCommunication(url, function(xhr, ajaxOptions, thrownError) { if (thrownError != "abort") { + if (xhr != null) { + if (xhr.status == 401) { + that.appendMessage("Chat problem - You're not logged in, go to the main page to log in", "warningMessage"); + return; + } + } that.appendMessage("Chat had a problem communicating with the server, no new messages will be displayed, but your messages still might get sent.", "warningMessage"); that.appendMessage("Reload the browser page (press F5) to resume the chat.", "warningMessage"); } diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/hallUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/hallUi.js index d9fb9b70c..78e75fdcb 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/hallUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/hallUi.js @@ -13,6 +13,12 @@ var GempLotrHallUI = Class.extend({ this.div = div; this.comm = new GempLotrCommunication(url, function(xhr, ajaxOptions, thrownError) { if (thrownError != "abort") { + if (xhr != null) { + if (xhr.status == 401) { + chat.appendMessage("Game hall problem - You're not logged in, go to the main page to log in", "warningMessage"); + return; + } + } chat.appendMessage("The game hall had a problem communicating with the server, no new updates will be displayed.", "warningMessage"); chat.appendMessage("Reload the browser page (press F5) to resume the game hall functionality.", "warningMessage"); }