On 06/05/2012 05:01 AM, Rob Crittenden wrote:
Petr Vobornik wrote:
On 05/29/2012 11:29 PM, Rob Crittenden wrote:
Petr Vobornik wrote:
IPA web UI isn't functional when browser doesn't send http headers.

This patch adds a functionality which sets Firefox
network.http.sendRefererHeader configuration option to value '2' which
enables it.

Possible values:
http://kb.mozillazine.org/Network.http.sendRefererHeader

https://fedorahosted.org/freeipa/ticket/2778

Should we also add a message when referer is missing to check this
setting in about:config?

I'm not sure what you have in mind. We set the referer option so why
would user check it afterwards?

Yes the ticket was about checking the option but: If user is configuring
the browser he wants the browser configured. So we should set all
options which are required. This is one of them. We have not been
notifying the user what was set, so I didn't add such notification for
this option now as well.

We might want to notify the user what options were changed but it's not
the topic of this ticket.

I was thinking more for already configured browsers who then later mess
with this value. It fails in a very non-obvious way.

rob

I'm attaching a patch which slightly changes the displayed error message from:

Missing or invalid HTTP Referer, missing

to:

Missing HTTP referer.
You have to configure your browser to send HTTP referer header.

Also I think we should document how to set it manually. We already have documentation for the rest of browser configuration.

--
Petr Vobornik
From dbe3075e2245caa4be3a3d1ddf634c54b8eb2633 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Tue, 5 Jun 2012 14:28:44 +0200
Subject: [PATCH] Custom Web UI error message for IPA error 911

Error message for IPA error 911 is not very clear for end users.

This patch changes the message and adds an advice how to get rid of the error.

https://fedorahosted.org/freeipa/ticket/2778
---
 install/ui/ipa.js                |   10 ++++++++++
 install/ui/jquery.ordered-map.js |   17 ++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/install/ui/ipa.js b/install/ui/ipa.js
index 648fcfc31e1f017aeecd597189b5d4a9789194ae..21e258cee5adf925d85665a71db0b96abdb18165 100644
--- a/install/ui/ipa.js
+++ b/install/ui/ipa.js
@@ -434,6 +434,9 @@ IPA.command = function(spec) {
     that.retry = typeof spec.retry == 'undefined' ? true : spec.retry;
 
     that.error_message = spec.error_message || IPA.get_message('dialogs.batch_error_message', 'Some operations failed.');
+    that.error_messages = $.ordered_map({
+        911: 'Missing HTTP referer. <br/> You have to configure your browser to send HTTP referer header.'
+    });
 
     that.get_command = function() {
         return (that.entity ? that.entity+'_' : '') + that.method;
@@ -563,6 +566,13 @@ IPA.command = function(spec) {
                 };
             }
 
+            // custom messages for set of codes
+            var error_msg = that.error_messages.get(error_thrown.code);
+            if (error_msg) {
+                error_msg = error_msg.replace('${message}', error_thrown.message);
+                error_thrown.message = error_msg;
+            }
+
             if (that.retry) {
                 dialog_open.call(this, xhr, text_status, error_thrown);
 
diff --git a/install/ui/jquery.ordered-map.js b/install/ui/jquery.ordered-map.js
index 7c0f3fadce9c5fde68540f1f3d585cf35af1b3ee..64cad6e0346c4281b680d523e17c550819171319 100755
--- a/install/ui/jquery.ordered-map.js
+++ b/install/ui/jquery.ordered-map.js
@@ -18,7 +18,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-jQuery.ordered_map = jQuery.fn.ordered_map = function() {
+jQuery.ordered_map = jQuery.fn.ordered_map = function(map) {
 
     var that = {};
 
@@ -49,6 +49,18 @@ jQuery.ordered_map = jQuery.fn.ordered_map = function() {
         that.map[key] = value;
     };
 
+    that.put_map = function(map) {
+
+        if (typeof map !== 'object') return;
+
+        for (name in map) {
+
+            if (map.hasOwnProperty(name)) {
+                that.put(name, map[name]);
+            }
+        }
+    };
+
     that.remove = function(key) {
 
         var i = that.get_key_index(key);
@@ -105,5 +117,8 @@ jQuery.ordered_map = jQuery.fn.ordered_map = function() {
         return new_map;
     };
 
+    that.put_map(map);
+
+
     return that;
 };
-- 
1.7.7.6

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to