Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

Commit

Permalink
added extra error message and form button validation to LDAPProxy.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Cole Goldsmith committed Apr 26, 2016
1 parent 0a446b9 commit 2e285e1
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion webadmin/var/www/webadmin/LDAPProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@

include "inc/header.php";

$proxies = $conf->getProxies();

if (isset($_POST['enableproxy']) && empty($proxies))
{
echo "<div class=\"alert alert-danger\">ERROR: Ensure you have added a LDAP Proxy specification</div>";
}

if (isset($_POST['disableproxy']))
{
suExec("disableproxy");
}

if (isset($_POST['enableproxy']))
if (isset($_POST['enableproxy']) && !empty($proxies))
{
suExec("enableproxy");
}
Expand Down Expand Up @@ -80,6 +86,25 @@
// ####################################################################
?>

<script>
//Ensure all inputs have values before enabling the add button

$(document).ready(function () {
validate();
$('#inLDAP, #outLDAP, #inURL').keyup(validate);
$('#inLDAP, #outLDAP, #inURL').change(validate);
});

function validate() {
if ($('#inLDAP').val().length > 0 &&
$('#outLDAP').val().length > 0 &&
$('#inURL').val().length > 0) {
$("#addProxy").prop("disabled", false);
} else {
$("#addProxy").prop("disabled", true);
}
}
</script>

<h2>LDAP Proxy</h2>

Expand Down

0 comments on commit 2e285e1

Please sign in to comment.