1 simpletest.pages.inc simpletest_settings_form_validate($form, &$form_state)

Validation handler for simpletest_settings_form().

File

core/modules/simpletest/simpletest.pages.inc, line 383
Page callbacks for simpletest module.

Code

function simpletest_settings_form_validate($form, &$form_state) {
  // If a username was provided but a password wasn't, preserve the existing
  // password.
  if (!empty($form_state['values']['simpletest_httpauth_username']) && empty($form_state['values']['simpletest_httpauth_password'])) {
    $form_state['values']['simpletest_httpauth_password'] = config_get('simpletest.settings', 'simpletest_password');
  }

  // If a password was provided but a username wasn't, the credentials are
  // incorrect, so throw an error.
  if (empty($form_state['values']['simpletest_httpauth_username']) && !empty($form_state['values']['simpletest_httpauth_password'])) {
    form_set_error('simpletest_httpauth_username', t('HTTP authentication credentials must include a username in addition to a password.'));
  }
}