Commit 904d28f8 authored by Project Update Bot's avatar Project Update Bot Committed by James Scott
Browse files

Issue #3296594 by Project Update Bot, jlscott: Automated Drupal 10...

Issue #3296594 by Project Update Bot, jlscott: Automated Drupal 10 compatibility fixes with manual override
parent 8ab46fd2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
name: Automatic User Names
type: module
description: "Allows a user's username to be assigned based on tokens or api hook."
core_version_requirement: ^8.7.7 || ^9
core_version_requirement: ^8.7.7 || ^9 || ^10
configure: auto_username.admin_config
dependencies:
  - token:token
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ use Drupal\auto_username\Form\AutoUsernameSettingsForm;
 */
function auto_username_form_user_register_form_alter(&$form, &$form_state, $form_id) {
  $form['account']['name']['#type'] = 'hidden';
  $form['account']['name']['#value'] = user_password();
  $form['account']['name']['#value'] = \Drupal::service('password_generator')->generate();
}

/**
+3 −2
Original line number Diff line number Diff line
@@ -308,8 +308,9 @@ class AutoUsernameSettingsForm extends ConfigFormBase {
  public static function autoUsernameGetSchemaNameMaxlength() {
    $maxlength = &drupal_static(__FUNCTION__);
    if (!isset($maxlength)) {
      $schema = drupal_get_module_schema('user');
      $maxlength = $schema['users_data']['fields']['name']['length'];
      $field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions('user', 'user');
      $name_settings = $field_definitions['name']->getItemDefinition()->getSettings();
      $maxlength = $name_settings['max_length'] ?? 255;
    }
    return $maxlength;
  }