Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

User Field Login

31 sites No security coverage
View on drupal.org

This module allows users to log in using values from any Drupal field, provided those values are unique. Administrators can configure which fields are enabled for login and customize the login form's username field.

INTRODUCTION

  • This module allows users to log in using field data values, administrators can
    customize the fields allowed to log in.
  • Special fields can use plug-ins or hooks to query the user UID to achieve
    login, for example: Phone number (field). You can also use any data to log in,
    you only need to query and output the user's UID.

REQUIREMENTS

  • Field values must be unique.
  • Field values cannot have special symbols or spaces.

INSTALLATION

Install the field login module as you would normally install a contributed
Drupal
module. Visit https://www.drupal.org/node/1897420 for further information.

CONFIGURATION

Go to "/admin/config/people/accounts/field-login" for the configuration screen,
available configuraitons:

- Select login field address: This option enables the user to login to the field
address
- Override login form: This option allows you to override the login form
username title/description.
- Login form username title: Override the username field title.
- Login form username description: Override the username field description.

HOOK FIELD LOGIN

Example: Phone number (field)

function hook_field_login(string $field_name, $inputValue): array {
  if ($field_name == 'field_telephone') {
    return \Drupal::entityQuery('user')
      ->accessCheck()
      ->condition('field_telephone.local_number', $inputValue)
      ->execute();
  }
  return [];
}

PLUGIN FIELD LOGIN

Example: Phone number (field)

Please place the file in your own module: src\Plugin\FieldLogin

use Drupal\field_login\FieldLoginPluginBase;

/**
 * Plugin implementation of the field_login.
 *
 * @FieldLogin(
 *   id = "phone",
 *   label = @Translation("Phone field"),
 *   description = @Translation("Phone field description."),
 *   field_name="field_phone",
 *   field_type="sms_phone_number"
 * )
 */
class PhoneField extends FieldLoginPluginBase {

  public function getAccountUid($inputValue): array {
    return \Drupal::entityQuery('user')
      ->accessCheck()
      ->condition('field_phone.local_number', $inputValue)
      ->execute();
  }

}

Activity

Total releases
3
First release
Apr 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 3
Maintenance
Dormant

Release Timeline

Releases

Version Type Release date
3.1.x-dev Dev Apr 11, 2025
3.1.1 Stable Apr 11, 2025
3.1.0 Stable Apr 10, 2025