You are here

public function BasicSettingsForm::validateForm in Auth0 Single Sign On 8.2

Same name and namespace in other branches
  1. 8 src/Form/BasicSettingsForm.php \Drupal\auth0\Form\BasicSettingsForm::validateForm()

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormBase::validateForm

File

src/Form/BasicSettingsForm.php, line 108
Contains \Drupal\auth0\Form\BasicSettingsForm.

Class

BasicSettingsForm
This forms handles the basic module configurations.

Namespace

Drupal\auth0\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (empty($form_state
    ->getValue('auth0_client_id'))) {
    $form_state
      ->setErrorByName('auth0_client_id', $this
      ->t('Please complete the application Client ID'));
  }
  if (empty($form_state
    ->getValue('auth0_client_secret'))) {
    $form_state
      ->setErrorByName('auth0_client_secret', $this
      ->t('Please complete the application Client Secret'));
  }
  if (empty($form_state
    ->getValue('auth0_domain'))) {
    $form_state
      ->setErrorByName('auth0_domain', $this
      ->t('Please complete your Auth0 domain'));
  }
  if (empty($form_state
    ->getValue(AuthHelper::AUTH0_JWT_SIGNING_ALGORITHM))) {
    $form_state
      ->setErrorByName(AuthHelper::AUTH0_JWT_SIGNING_ALGORITHM, $this
      ->t('Please complete your Auth0 Signature Algorithm'));
  }
}