LDAP Wizard: enable/disable test login name button depending on whether a login name is provided or not

This commit is contained in:
Arthur Schiwon 2015-09-24 13:33:37 +02:00
parent 8d6ec660a2
commit 8e57757045
2 changed files with 13 additions and 2 deletions

View File

@ -71,7 +71,8 @@ OCA = OCA || {};
],
'ldap_login_filter_mode'
);
_.bindAll(this, 'onVerifyClick');
_.bindAll(this, 'onVerifyClick', 'onTestLoginnameChange');
this.managedItems.ldap_test_loginname.$element.keyup(this.onTestLoginnameChange);
this.managedItems.ldap_test_loginname.$relatedElements.click(this.onVerifyClick);
},
@ -231,6 +232,16 @@ OCA = OCA || {};
} else {
this.configModel.requestWizard('ldap_test_loginname', {ldap_test_loginname: testLogin});
}
},
/**
* enables/disables the "Verify Settings" button, depending whether
* the corresponding text input has a value or not
*/
onTestLoginnameChange: function() {
var loginName = this.managedItems.ldap_test_loginname.$element.val();
var beDisabled = !_.isString(loginName) || !loginName.trim();
this.managedItems.ldap_test_loginname.$relatedElements.prop('disabled', beDisabled);
}
});

View File

@ -52,7 +52,7 @@
placeholder="<?php p($l->t('Test Loginname'));?>"
class="ldapVerifyInput"
title="Attempts to receive a DN for the given loginname and the current login filter"/>
<button class="ldapVerifyLoginName" name="ldapTestLoginSettings" type="button">
<button class="ldapVerifyLoginName" name="ldapTestLoginSettings" type="button" disabled="disabled">
<?php p($l->t('Verify settings'));?>
</button>
</p>