You are here

function _recovery_pass_validate_path in Recovery Password (Email New Password) 8

Same name and namespace in other branches
  1. 7 recovery_pass.admin.inc \_recovery_pass_validate_path()

Validates path entered by user.

1 string reference to '_recovery_pass_validate_path'
RecoveryPassSettingsForm::buildForm in src/RecoveryPassSettingsForm.php
Form constructor.

File

./recovery_pass.module, line 111
Contains module code.

Code

function _recovery_pass_validate_path($element, FormState $form_state) {
  $path = $element['#value'];
  if (!empty($path)) {
    if (!\Drupal::service('path.validator')
      ->isValid($path)) {
      $form_state
        ->setError($element, t('Please provide valid redirect path.'));
    }
  }
}