diff --git a/alt_login.make.yml b/alt_login.make.yml deleted file mode 100644 index 6cb13d23a2266141cd34168795ceca34dc8047ab..0000000000000000000000000000000000000000 --- a/alt_login.make.yml +++ /dev/null @@ -1,6 +0,0 @@ -core: "8.x" -api: 2 -projects: - token: - type: "module" - version: "1.5" diff --git a/alt_login.module b/alt_login.module index 2ee84900a86acaff14d42ce3e456ca7a8ff27d4f..adac79a0cb302d31a015410df1fc026ca24306af 100644 --- a/alt_login.module +++ b/alt_login.module @@ -84,7 +84,7 @@ function alt_login_form_alter(&$form, $form_state, $form_id) { if (empty($user_aliases['username'])) { $namefield['#access'] = FALSE; if ($user->isNew()) { - $namefield['#value'] = user_password(8); + $namefield['#value'] = \Drupal::service('password_generator')->generate(8); } elseif (count($user_aliases) == 1) { $labels = \Drupal::service('alt_login.method_manager')->getActiveLabels(); diff --git a/src/Plugin/AltLoginMethod/AddressName.php b/src/Plugin/AltLoginMethod/AddressName.php index 951c2b9a3fd1bc809c53891a5d06a0fa16caf710..937840f2634a224839f7762bc85f6a2fe98eb2a0 100644 --- a/src/Plugin/AltLoginMethod/AddressName.php +++ b/src/Plugin/AltLoginMethod/AddressName.php @@ -19,7 +19,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * * @AltLoginMethod( * id = "address_name", - * label = @Translation("Full name"), + * label = @Translation("Address firstname + lastname"), * description = @Translation("The given name and family name from the address field. Warning, duplicate names could lead to login and other confusions.") * ) */ @@ -48,6 +48,11 @@ class AddressName implements AltLoginMethodInterface, ContainerFactoryPluginInte */ private $entityTypeManager; + /** + * @var MessengerInterface + */ + private $messenger; + /** * @param EntityFieldManagerInterface $entity_field_manager * @param Connection $database @@ -137,15 +142,15 @@ class AddressName implements AltLoginMethodInterface, ContainerFactoryPluginInte return $this->fieldName; } + /** + * {@inheritdoc} + */ private function getUids($alias) { $fname = $this->fieldName(); - $table = 'user__'.$fname; - $query = $this->database->select($table, 'u') + $query = $this->database + ->select('user__'.$fname, 'u') ->fields('u', ['entity_id']) - ->where( - "CONCAT_WS(:space, {$fname}_given_name, {$fname}_family_name) ='".$alias."'", - [':space' => ' '] - ); + ->where("CONCAT_WS(' ', {$fname}_given_name, {$fname}_family_name) = '$alias'"); // Hopefully the database field isn't case sensitive. return $query->execute()->fetchCol(); } diff --git a/src/Settings.php b/src/Settings.php index 752f06123e924a765da259732588d5aca13e68bc..248bbfe2eac11884dc34f56a1ae1318f23c8d4d3 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -25,7 +25,7 @@ class Settings extends ConfigFormBase { $config = $this->config('alt_login.settings'); $form['aliases'] = [ '#title' => $this->t('Allow login with'), - '#description' => $this->t('Unchecking the username prevents its use for logging in.'), + '#description' => $this->t('Unchecking the username prevents its use for logging in, and hides the username field from the user form.'), '#type' => 'checkboxes', '#options' => \Drupal::service('alt_login.method_manager')->getOptions(), '#default_value' => (array)$config->get('aliases'),