summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-01-23 07:41:10 +0700
committerAdam Young <ayoung@redhat.com>2011-01-26 16:42:55 -0500
commitadd7d701c688be4d9699034427e5ab1be67a8bac (patch)
treebc508017c5539ab103acd86925e9c46d66fcc356 /install
parent5ca58d58b3563e9e275aa9eda2951e1123377dbd (diff)
downloadfreeipa-add7d701c688be4d9699034427e5ab1be67a8bac.tar.gz
freeipa-add7d701c688be4d9699034427e5ab1be67a8bac.tar.xz
freeipa-add7d701c688be4d9699034427e5ab1be67a8bac.zip
Check field's validity before executing add.
Diffstat (limited to 'install')
-rw-r--r--install/ui/add.js1
-rwxr-xr-xinstall/ui/certificate.js12
-rw-r--r--install/ui/host.js8
-rw-r--r--install/ui/service.js8
-rw-r--r--install/ui/widget.js11
5 files changed, 22 insertions, 18 deletions
diff --git a/install/ui/add.js b/install/ui/add.js
index 69b1108c3..89527ba23 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 b7e5a51d3..4f12fc0cc 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 c3851ff75..422c87a77 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 81f00ec77..e24088848 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 90f6dac8b..f34532d23 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;
}
}