You are here

function ldap_servers_disable_http_check in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7 ldap_servers/ldap_servers.module \ldap_servers_disable_http_check()

disable a logon form if ldap preferences exclude http logon forms

Parameters

drupal logon form array $form:

1 call to ldap_servers_disable_http_check()
_ldap_authentication_login_form_alter in ldap_authentication/ldap_authentication.inc
helper function for ldap_authn_form_user_login_block_alter and ldap_authn_form_user_login_alter

File

ldap_servers/ldap_servers.module, line 798

Code

function ldap_servers_disable_http_check(&$form) {
  if (config('ldap_servers.settings')
    ->get('require_ssl_for_credentails') == 1 && @$_SERVER['HTTPS'] != 'on') {
    $tokens = array(
      'site_name' => config('system.site')
        ->get('name'),
      'site_mail' => config('system.site')
        ->get('mail'),
    );
    drupal_set_message(t(theme('ldap_servers_https_required', $tokens)), 'error');
    $form['#disabled'] = TRUE;
  }
}