mirror of
https://github.com/srlabs/blue-merle.git
synced 2024-12-22 21:59:25 -05:00
Merge pull request #11 from srlabs/verifyimei_len
Added IMEI character length validation check
This commit is contained in:
commit
406360fad2
@ -141,6 +141,10 @@ def generate_imei(imei_prefix, imsi_d):
|
|||||||
|
|
||||||
|
|
||||||
def validate_imei(imei):
|
def validate_imei(imei):
|
||||||
|
# before anything check if length is 14 characters
|
||||||
|
if len(imei) != 14:
|
||||||
|
print(f"NOT A VALID IMEI: {imei} - IMEI must be 14 characters in length")
|
||||||
|
return False
|
||||||
# cut off last digit
|
# cut off last digit
|
||||||
validation_digit = int(imei[-1])
|
validation_digit = int(imei[-1])
|
||||||
imei_verify = imei[0:14]
|
imei_verify = imei[0:14]
|
||||||
|
Loading…
Reference in New Issue
Block a user