Hi,

The attached patch should fix the following bug:
https://fedorahosted.org/freeipa/ticket/669
It now shows the server's actual response: "Internal Server Error".

Additional improvements can be done by validating the input on client side and/or server side.

--
Endi S. Dewata
From 604dc3952290b8fcba6da8b4307e798cdd37b155 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
Date: Wed, 5 Jan 2011 21:20:31 +0700
Subject: [PATCH] Use AJAX status text as default error message.

The ipa_cmd() error handler has been updated to use AJAX status
text as the default error message.
---
 install/static/ipa.js |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/install/static/ipa.js b/install/static/ipa.js
index ac8a0f2657ea613e5b6e67c2b14122f2961c7f78..b340d8350e6bf83940ac8ad7dfa128f795b0f5a0 100644
--- a/install/static/ipa.js
+++ b/install/static/ipa.js
@@ -314,21 +314,25 @@ function ipa_cmd(name, args, options, win_callback, fail_callback, objname, comm
     }
 
     function error_handler(xhr, text_status, error_thrown) {
-        if (!error_thrown){
-            error_thrown = {name:'unknown'}
+
+        if (!error_thrown) {
+            error_thrown = {
+                name: xhr.responseText || 'Unknown Error',
+                message: xhr.statusText || 'Unknown Error'
+            }
         }
 
-        if (xhr.status === 401){
-            error_thrown.name  = 'Kerberos ticket no longer valid.';
+        if (xhr.status === 401) {
+            error_thrown.name = 'Kerberos ticket no longer valid.';
             if (IPA.messages && IPA.messages.ajax){
-                error_thrown.message =  IPA.messages.ajax["401"];
-            }else{
+                error_thrown.message = IPA.messages.ajax["401"];
+            } else {
                 error_thrown.message =
-                    "Your kerberos ticket no longer valid."+
-                    "Please run kinit and then click 'retry'"+
-                    "If this is your first time running the IPA Web UI"+
-                    "<a href='/ipa//config/unauthorized.html'> "+
-                    "Follow these directions</a> to configure your browser."
+                    "Your kerberos ticket no longer valid. "+
+                    "Please run kinit and then click 'retry'. "+
+                    "If this is your first time running the IPA Web UI "+
+                    "<a href='/ipa/config/unauthorized.html'>"+
+                    "follow these directions</a> to configure your browser."
             }
         }
 
-- 
1.6.6.1

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

Reply via email to