Loading fbl.module +5 −0 Changes for fbl.module: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ * Module file for the field based login module. */ use Drupal\user\Entity\User; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Url; Loading Loading @@ -76,11 +77,15 @@ function fbl_user_register_validate($form, FormStateInterface &$form_state) { $results = $query->execute(); // If any results, let's throw error. if (count($results)) { // Get current user. $current_user = User::load(\Drupal::currentUser()->id()); if ((!isset($results[$current_user->id()]) || $current_user->id() === 0) && !$current_user->hasPermission('administer users')) { $form_state->setErrorByName($field_name, t('The entered value already exists. Please enter a different value.')); } } } } } /** * Custom validate function to check custom user field records. Loading Loading
fbl.module +5 −0 Changes for fbl.module: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ * Module file for the field based login module. */ use Drupal\user\Entity\User; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Url; Loading Loading @@ -76,11 +77,15 @@ function fbl_user_register_validate($form, FormStateInterface &$form_state) { $results = $query->execute(); // If any results, let's throw error. if (count($results)) { // Get current user. $current_user = User::load(\Drupal::currentUser()->id()); if ((!isset($results[$current_user->id()]) || $current_user->id() === 0) && !$current_user->hasPermission('administer users')) { $form_state->setErrorByName($field_name, t('The entered value already exists. Please enter a different value.')); } } } } } /** * Custom validate function to check custom user field records. Loading