original_string: public function validate($data) {
  
          if (get_config('auth_ldap', 'ntlmsso_type') === 'ntlm') {
              $format = trim($data);
              if (!empty($format) && !preg_match('/%username%/i', $format)) {
                  return get_string('auth_ntlmsso_missing_username', 'auth_ldap');
              }
          }
  
          return parent::validate($data);
      }
code: public function validate($data) {
  
          if (get_config('auth_ldap', 'ntlmsso_type') === 'ntlm') {
              $format = trim($data);
              if (!empty($format) && !preg_match('/%username%/i', $format)) {
                  return get_string('auth_ntlmsso_missing_username', 'auth_ldap');
              }
          }
  
          return parent::validate($data);
      }
code_tokens: public function validate ( $ data ) { if ( get_config ( 'auth_ldap' , 'ntlmsso_type' ) === 'ntlm' ) { $ format = trim ( $ data ) ; if ( ! empty ( $ format ) && ! preg_match ( '/%username%/i' , $ format ) ) { return get_string ( 'auth_ntlmsso_missing_username' , 'auth_ldap' ) ; } } return parent :: validate ( $ data ) ; }
docstring: We need to validate the username format when using NTLM.
  
  @param string $data Form data.
  @return string Empty when no errors.
docstring_tokens: We need to validate the username format when using NTLM .