Mobile Number is a field type that provides mobile number validation and verification, and can be used for two factor authentication. It works with SMS Framework and TFA modules, respectively, and both features are optional.
The module differs from the Phone module in that it puts security and authenticity first, and focuses on mobile numbers which therefore assumes sms and smartphone capabilities by the user. The number is sanitized before saving, country is validated, the number is validated to be a mobile number type, allows uniqueness validation, and, if enabled, allows verifying number ownership by the user. For verification, codes are hashed and tokenized in the database. See the case for a dedicated mobile number field.
The module uses libphonenumber (developed by Google for use in Android) for validation, and supports the mobile number formats of the countries listed here, which is basically all of them.
Feature requests are welcomed.
Supported modules
- Composer Manager
- Views
- Rules
- Feeds
- Webform - Webform component for mobile numbers.
- TFA - For two factor authentication.
- SMS Framework - For sms verification.
- Telephone - Mobile number widget for Telephone.
- Devel generate
- Services - Request verification code resource. Mobile apps can now use sms verification.
Requirements
- Libraries module (D7 only)
- libphonenumber library. The module was last tested on version 8.5.2.
- PHP 5.3 or newer
Installation D7
- Download and enable mobile_number module
- Download into your libraries folder the libphonenumber project under the name libphonenumber. Alternatively, you can use
drush libphonenumber-download
command, or install the library with Composer Manager. - For mobile number verification, download, enable, and configure SMS Framework. You will need to setup an SMS gateway, which will require setting up an account and paying fees on a 3rd party service, or use SMS Framework's default logger gateway for testing.
- For two factor authentication, complete step 3 and download, enable, and configure TFA. Currently not available for Drupal 8.
Installation D8
- Install mobile_number module, preferably using composer
composer require drupal/mobile_number
- If the module was not installed with composer, install dependencies with composer
composer require giggsey/libphonenumber-for-php ^8.0
- For mobile number verification, download, enable, and configure SMS Framework. You will need to setup an SMS gateway, which will require setting up an account and paying fees on a 3rd party service, or use SMS Framework's default logger gateway for testing.
- Two factor authentication is not available for D8
Project information
- Module categories: Site Structure, Security, Access Control
- 1,100 sites report using this module
- Created by nyariv on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 2.0.x-dev updated 16 Jan 2024 at 18:57 UTC
Development version: 7.x-1.x-dev updated 1 Jan 2019 at 23:48 UTC