Login to drupal with just a number
You should definitely have a look at the Identification module. Some details (from its project page):

... allows users to login with a custom identification number (or string). To configure this module, the site builder creates a (or specifies a pre-existing) field on the user entity. The value stored in this field for a particular user can then be used as the identification login credential.
Use Case
An organization that wants users to be able to login using a custom identification number and password. This means each user account will have three unique identifiers:

core user name
core user e-mail address
custom user identification number (or string)


Credits (and kudos) to tyler frankenstein!
Note: This answer applies to both D7 and D8.