On 01/24/2011 01:11 PM, Adam Young wrote:
On 01/22/2011 07:49 PM, Endi Sukma Dewata wrote:
This should fix this bug:
https://fedorahosted.org/freeipa/ticket/660


_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel
NACK:  Too many false positives:

Try adding a user group. Group name works as designed, others do not allow anything through. Ithink you are not accounting fro null validation.


_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel
With this change it works. ACK and pushed to master
From add7d701c688be4d9699034427e5ab1be67a8bac Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
Date: Sun, 23 Jan 2011 07:41:10 +0700
Subject: [PATCH] Check field's validity before executing add.

---
 install/ui/add.js         |    1 +
 install/ui/certificate.js |   12 ++++++------
 install/ui/host.js        |    8 ++++----
 install/ui/service.js     |    8 ++++----
 install/ui/widget.js      |   11 +++++++----
 5 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/install/ui/add.js b/install/ui/add.js
index 69b1108c31a72b281129624630e0bfb6238f25fe..89527ba23b0a8be77e882e7cb569066f2236e4f6 100644
--- a/install/ui/add.js
+++ b/install/ui/add.js
@@ -101,6 +101,7 @@ IPA.add_dialog = function (spec) {
 
         for (var i=0; i<that.fields.length; i++) {
             var field = that.fields[i];
+            if (!field.valid) return;
 
             var value = record[field.name];
             if (!value) continue;
diff --git a/install/ui/certificate.js b/install/ui/certificate.js
index b7e5a51d3e4d6d9f37d4d1c9b23854f68b2ebb48..4f12fc0cc6ff62c5b4b171a957a5ae92a1dcd955 100755
--- a/install/ui/certificate.js
+++ b/install/ui/certificate.js
@@ -536,9 +536,9 @@ function certificate_status_widget(spec) {
 
         that.widget_setup(container);
 
-        that.valid = $('div[name=certificate-valid]', that.container);
-        that.revoked = $('div[name=certificate-revoked]', that.container);
-        that.missing = $('div[name=certificate-missing]', that.container);
+        that.status_valid = $('div[name=certificate-valid]', that.container);
+        that.status_revoked = $('div[name=certificate-revoked]', that.container);
+        that.status_missing = $('div[name=certificate-missing]', that.container);
 
         var button = $('input[name=get]', that.container);
         that.get_button = IPA.button({
@@ -620,11 +620,11 @@ function certificate_status_widget(spec) {
     };
 
     function set_status(status, revocation_reason) {
-        that.valid.css('display', status == CERTIFICATE_STATUS_VALID ? 'inline' : 'none');
-        that.missing.css('display', status == CERTIFICATE_STATUS_MISSING ? 'inline' : 'none');
+        that.status_valid.css('display', status == CERTIFICATE_STATUS_VALID ? 'inline' : 'none');
+        that.status_missing.css('display', status == CERTIFICATE_STATUS_MISSING ? 'inline' : 'none');
 
         if (!that.is_selfsign()) {
-            that.revoked.css('display', status == CERTIFICATE_STATUS_REVOKED ? 'inline' : 'none');
+            that.status_revoked.css('display', status == CERTIFICATE_STATUS_REVOKED ? 'inline' : 'none');
             that.revoke_button.css('visibility', status == CERTIFICATE_STATUS_VALID ? 'visible' : 'hidden');
             that.revocation_reason.html(revocation_reason == undefined ? '' : CRL_REASON[revocation_reason]);
             that.restore_button.css('visibility', revocation_reason == 6 ? 'visible' : 'hidden');
diff --git a/install/ui/host.js b/install/ui/host.js
index c3851ff75e7baf3c29389f1234d49943d3f3ef26..422c87a7728f9bd19057f8b173d2139fe08c27dc 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -299,8 +299,8 @@ function host_provisioning_status_widget(spec) {
 
         that.widget_setup(container);
 
-        that.valid = $('div[name=kerberos-key-valid]', that.container);
-        that.missing = $('div[name=kerberos-key-missing]', that.container);
+        that.status_valid = $('div[name=kerberos-key-valid]', that.container);
+        that.status_missing = $('div[name=kerberos-key-missing]', that.container);
 
         var button = $('input[name=unprovision]', that.container);
         that.unprovision_button = IPA.button({
@@ -397,8 +397,8 @@ function host_provisioning_status_widget(spec) {
     };
 
     function set_status(status) {
-        that.valid.css('display', status == 'valid' ? 'inline' : 'none');
-        that.missing.css('display', status == 'missing' ? 'inline' : 'none');
+        that.status_valid.css('display', status == 'valid' ? 'inline' : 'none');
+        that.status_missing.css('display', status == 'missing' ? 'inline' : 'none');
     }
 
     return that;
diff --git a/install/ui/service.js b/install/ui/service.js
index 81f00ec77599b5eb7462a4d0de9ff7b7629fb217..e240888486ebe7b8ab407eb15907ea9cf5e9bf2f 100644
--- a/install/ui/service.js
+++ b/install/ui/service.js
@@ -355,8 +355,8 @@ function service_provisioning_status_widget(spec) {
 
         that.widget_setup(container);
 
-        that.valid = $('div[name=kerberos-key-valid]', that.container);
-        that.missing = $('div[name=kerberos-key-missing]', that.container);
+        that.status_valid = $('div[name=kerberos-key-valid]', that.container);
+        that.status_missing = $('div[name=kerberos-key-missing]', that.container);
 
         var button = $('input[name=unprovision]', that.container);
         that.unprovision_button = IPA.button({
@@ -405,8 +405,8 @@ function service_provisioning_status_widget(spec) {
     };
 
     function set_status(status) {
-        that.valid.css('display', status == 'valid' ? 'inline' : 'none');
-        that.missing.css('display', status == 'missing' ? 'inline' : 'none');
+        that.status_valid.css('display', status == 'valid' ? 'inline' : 'none');
+        that.status_missing.css('display', status == 'missing' ? 'inline' : 'none');
     }
 
     return that;
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 90f6dac8bf47dec2ef17bcd4a84648ffd829d99d..f34532d23b3ca2e31f63b07446d96259997f2d53 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -46,6 +46,7 @@ IPA.widget = function(spec) {
     that.save = spec.save || save;
     that.update = spec.update || update;
     that.validate_input = spec.validate_input || validate_input;
+    that.valid = true;
     that.param_info = spec.param_info;
 
     that.__defineGetter__("entity_name", function(){
@@ -61,23 +62,25 @@ IPA.widget = function(spec) {
       displays the error message and returns false. */
     function validate_input(text) {
         if (!(that.param_info && that.param_info.pattern)) {
-            return true;
+            that.valid = true;
+            return;
         }
         var error_link = that.get_error_link();
         if (!error_link) {
-            return true;
+            that.valid = true;
+            return;
         }
         var regex = new RegExp( that.param_info.pattern );
         //If the field is empty, don't validate
         if ( !text || text.match(regex) ) {
             error_link.css('display', 'none');
-            return true;
+            that.valid = true;
         }else{
             error_link.css('display', 'block');
             if (that.param_info.pattern_errmsg) {
                 error_link.html(that.param_info.pattern_errmsg);
             }
-            return false;
+            that.valid = false;
         }
     }
 
-- 
1.7.3.5

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

Reply via email to