-
Notifications
You must be signed in to change notification settings - Fork 0
/
OTPVerify.py
80 lines (64 loc) · 2.02 KB
/
OTPVerify.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# from pprint import pprint
import random
import tkinter as tk
import nexmo
def check():
if str(entry_otp.get()) == secretKey:
print("User verification successfull. Please Complete the next Coming Form")
root.destroy()
else:
print("Incorrect OTP")
def verifier(mobileNo):
global entry_otp
global secretKey
global root
secretPass = str(random.randint(0, 9)) + " " + str(random.randint(0, 9)) + " " + str(
random.randint(0, 9)) + " " + str(random.randint(0, 9))
otp = " your OTP is ...." + secretPass
otp2 = " ......... I repeat " + otp
secretPass = secretPass.split()
secretKey = ""
for i in secretPass:
if i != " ":
secretKey += i
mobileNo = str(mobileNo)
client = nexmo.Client(
application_id='619ca1fa-7104-4e90-a72b-ba831956ceb5',
private_key='private.key',
)
ncco = [{
'action': 'talk',
'voiceName': 'Joey',
'text': otp + otp2
}]
response = client.create_call({
'to': [{
'type': 'phone',
'number': mobileNo
}],
'from': {
'type': 'phone',
'number': '919726753852'
},
'ncco': ncco
})
root = tk.Tk()
root.title("Verify OTP")
# root.state('zoomed')
root.geometry("350x130")
root.resizable(0, 0)
f1 = tk.Frame(root)
f1.grid(row=0, column=0)
f2 = tk.Frame(root)
f2.grid(row=1, column=0)
verifyotp = tk.Label(f1, text="Verify OTP", width=20, font=("bold", 20))
verifyotp.grid(row=0, column=0)
otpLabel = tk.Label(f2, text="Enter OTP", width=20, font=("bold", 10), pady=10)
otpLabel.grid(row=0, column=0)
entry_otp = tk.Entry(f2, width=25)
entry_otp.grid(row=0, column=1)
resendButton = tk.Button(f2, text="Resend OTP", fg='blue', relief="flat")
resendButton.grid(row=2, column=1)
submitButton = tk.Button(f2, text="Submit", command=check, bg='brown', fg='white')
submitButton.grid(row=1, column=1)
root.mainloop()