mirror of
https://github.com/metafy-social/python-scripts.git
synced 2024-11-23 20:11:10 +00:00
added python-script for generate OTP
This commit is contained in:
parent
6a96ef559f
commit
63de434939
13
scripts/otp_generator/generateOTP.py
Normal file
13
scripts/otp_generator/generateOTP.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import random
|
||||||
|
def otp(num):
|
||||||
|
result=""
|
||||||
|
if(len(str(num))==10):
|
||||||
|
for i in range(6):
|
||||||
|
digit=str(random.randint(0,9))
|
||||||
|
result=result+digit
|
||||||
|
return result
|
||||||
|
else:
|
||||||
|
s="Enter a valid mobile number!"
|
||||||
|
return s
|
||||||
|
|
||||||
|
print(otp(9874453920))
|
5
scripts/otp_generator/readme.md
Normal file
5
scripts/otp_generator/readme.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
# OTP GENERATOR
|
||||||
|
|
||||||
|
In this project, a 6 digit OTP will be auto generated when user gives a valid 10 digit mobile number. This is written in python and can be implemented in websites as well for authentication.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user