You are here

function ldap_authentication_admin_form_submit in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_authentication/ldap_authentication.admin.inc \ldap_authentication_admin_form_submit()
  2. 7 ldap_authentication/ldap_authentication.admin.inc \ldap_authentication_admin_form_submit()

Submit handler function for ldap_authentication_admin_form.

File

ldap_authentication/ldap_authentication.admin.inc, line 39
Administrative page callbacks for the ldap_authentication module.

Code

function ldap_authentication_admin_form_submit($form, &$form_state) {
  ldap_servers_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class');
  $auth_conf = new LdapAuthenticationConfAdmin();

  // Add form data to object and save or create.
  $auth_conf
    ->drupalFormSubmit($form_state['values']);
  if (!$auth_conf
    ->hasEnabledAuthenticationServers()) {
    drupal_set_message(t('No LDAP servers are enabled for authentication,
      so no LDAP Authentication can take place.  This essentially disables
      LDAP Authentication.'), 'warning');
  }
  if ($auth_conf->hasError == FALSE) {
    drupal_set_message(t('LDAP Authentication configuration saved'), 'status');
    drupal_goto(LDAP_SERVERS_MENU_BASE_PATH . '/authentication');
  }
  else {
    form_set_error($auth_conf->errorName, $auth_conf->errorMsg);
    $auth_conf
      ->clearError();
  }
}