From 2307c6fbda8ef149aebf83d47d099ca6d94f7ffc Mon Sep 17 00:00:00 2001 From: Gared Date: Sun, 28 Dec 2014 15:02:56 +0100 Subject: [PATCH 1/2] Notify user if cookies can't be created --- src/locales/en.json | 1 + src/static/css/pad.css | 4 ++++ src/static/js/pad.js | 10 ++++++++++ src/templates/pad.html | 3 +++ 4 files changed, 18 insertions(+) diff --git a/src/locales/en.json b/src/locales/en.json index 9a5fe45f1..cea312633 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -24,6 +24,7 @@ "pad.colorpicker.cancel": "Cancel", "pad.loading": "Loading...", + "pad.nocookie": "Cookie could not be found. Please allow cookies in your browser!", "pad.passwordRequired": "You need a password to access this pad", "pad.permissionDenied": "You do not have permission to access this pad", "pad.wrongPassword": "Your password was wrong", diff --git a/src/static/css/pad.css b/src/static/css/pad.css index c1035e8d5..b163a9a49 100644 --- a/src/static/css/pad.css +++ b/src/static/css/pad.css @@ -1086,6 +1086,10 @@ input[type=checkbox] { display:none; } +#nocookie{ + display:none; +} + /* gritter stuff */ #gritter-notice-wrapper { position:fixed; diff --git a/src/static/js/pad.js b/src/static/js/pad.js index 89ebfa764..6ca9e1424 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -442,6 +442,16 @@ var pad = { if (typeof customStart == "function") customStart(); getParams(); handshake(); + + // To use etherpad you have to allow cookies. + // This will check if the creation of a test-cookie has success. + // Otherwise it shows up a message to the user. + createCookie("test", "test"); + if (!readCookie("test")) + { + $('#loading').hide(); + $('#nocookie').show(); + } }); }, _afterHandshake: function() diff --git a/src/templates/pad.html b/src/templates/pad.html index 2dd66aa90..c6d48cd33 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -114,6 +114,9 @@

Your password was wrong

+
+

Cookie could not be found. Please allow cookies in your browser!

+
<% e.begin_block("loading"); %>

Loading...

<% e.end_block(); %> From 018821e98c3e315eb37e55c05e743dc1268d04ad Mon Sep 17 00:00:00 2001 From: Gared Date: Sun, 28 Dec 2014 22:20:09 +0100 Subject: [PATCH 2/2] Use camel case --- src/locales/en.json | 2 +- src/static/css/pad.css | 2 +- src/static/js/pad.js | 2 +- src/templates/pad.html | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index cea312633..130b59cba 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -24,7 +24,7 @@ "pad.colorpicker.cancel": "Cancel", "pad.loading": "Loading...", - "pad.nocookie": "Cookie could not be found. Please allow cookies in your browser!", + "pad.noCookie": "Cookie could not be found. Please allow cookies in your browser!", "pad.passwordRequired": "You need a password to access this pad", "pad.permissionDenied": "You do not have permission to access this pad", "pad.wrongPassword": "Your password was wrong", diff --git a/src/static/css/pad.css b/src/static/css/pad.css index b163a9a49..f1f859c15 100644 --- a/src/static/css/pad.css +++ b/src/static/css/pad.css @@ -1086,7 +1086,7 @@ input[type=checkbox] { display:none; } -#nocookie{ +#noCookie{ display:none; } diff --git a/src/static/js/pad.js b/src/static/js/pad.js index 6ca9e1424..96c6f3308 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -450,7 +450,7 @@ var pad = { if (!readCookie("test")) { $('#loading').hide(); - $('#nocookie').show(); + $('#noCookie').show(); } }); }, diff --git a/src/templates/pad.html b/src/templates/pad.html index c6d48cd33..e442ef00e 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -114,8 +114,8 @@

Your password was wrong

-
-

Cookie could not be found. Please allow cookies in your browser!

+
+

Cookie could not be found. Please allow cookies in your browser!

<% e.begin_block("loading"); %>

Loading...