Phone Number

Overview

In Jframework, the Phone Number is a core identifier for user. The system uses phone numbers to:

  • Send and receive SMS OTPs for login and phone number verification.

  • Allow users to register a new user using their phone numbers.

  • Serve as a secure method of identity verification.

Within a single brand, each phone number must be unique. This ensures that one phone number can only be associated with a single user in that brand.

E.164 Format

To maintain global compatibility and consistency, Jframework stores phone numbers in the E.164 format:

  • Begins with a "+" sign.

  • Followed by the country calling code.

  • Contains no spaces, dashes, or other special characters.

Examples:

Country
Original Number
E.164 Format

Vietnam

0912345678

+84912345678

United States

(415) 555-2671

+14155552671


Validation Rules

When creating or updating a phone number in Jframework:

  1. Required — A valid phone number must be provided.

  2. Format — Must comply with the E.164 standard.

  3. Uniqueness — Must be unique within the same brand.

  4. Length — Maximum of 15 digits (excluding the “+” sign).

  5. Characters — Only "+" followed by digits 0-9 are allowed.

Regex Pattern for E.164 Validation

^\+[1-9]\d{1,14}$

Explanation:

  • ^ — Start of string.

  • \+ — Matches the “+” sign.

  • [1-9] — First digit must be between 1 and 9 (no leading zero).

  • \d{1,14} — Followed by 1 to 14 digits.

  • $ — End of string.


Storage Rules

  • Stored in the database as a string in E.164 format.

  • Indexed by brand for fast uniqueness checks.

  • Normalized before storage to ensure consistent formatting across all entries.

Last updated

Was this helpful?