You are here

function securesite_user_validate in Secure Site 8

Same name and namespace in other branches
  1. 7.2 securesite.module \securesite_user_validate()

Validation callback for user registration and profile.

1 string reference to 'securesite_user_validate'
securesite_form_alter in ./securesite.module
Implements hook_form_alter().

File

./securesite.module, line 137
Enables HTTP authentication or an HTML form to restrict site access.

Code

function securesite_user_validate($form, FormStateInterface $form_state) {
  if (!array_key_exists('name', $form_state
    ->getErrors($form_state)) && isset($form_state['values']['name']) && $form_state['values']['name'] == \Drupal::config('securesite.settings')
    ->get('securesite_guest_name')) {
    $form_state
      ->setErrorByName('name', t('The name %name is being used as the %site guest name.', array(
      '%name' => $form_state['values']['name'],
      '%site' => \Drupal::config('system.site')
        ->get('name'),
    )));
  }
}