-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendotp.py
80 lines (64 loc) · 2.12 KB
/
sendotp.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 tkinter import *
import tkinter.messagebox as tsmg
import requests
import random
import json
root=Tk()
rand=random.randint(1,999999)
msg=f"Your One Time Password(OTP) is {rand}"
def sms_send(a,msg):
url="https://www.fast2sms.com/dev/bulk"
params={
// Paste Your Unique API Here in-place of ************
"authorization":"*************",
"sender_id":"SMSINI",
"message":msg,
"language":"english",
"route":"p",
"numbers":a
}
rs=requests.get(url,params=params)
def send():
a=num.get()
if(a==""):
tsmg.showerror("Error","Enter Your Mobile Number")
elif (len(a)<10):
tsmg.showerror("Error","Invalid Mobile Number")
num.set("")
else:
b=tsmg.askyesno("Info",f"Your Number is {a}")
if(b==True):
sms_send(a,msg)
else:
num.set("")
def check():
c=otp.get()
if(c==""):
tsmg.showerror("Error","Enter OTP")
else:
if(str(rand)==c):
tsmg.showinfo("Info","Successful")
else:
tsmg.showerror("Error","Invalid OTP")
num.set("")
otp.set("")
root.geometry("500x500")
root.title("OTP-Checker")
num=StringVar()
otp=StringVar()
f1=Frame(root)
Label(f1,text="Check Your OTP",font="SegoeUI 30 bold",fg="purple").pack(padx=5,pady=10)
f1.pack(fill=BOTH)
f2=Frame(root)
Label(f2,text="Enter Your Number",font="SegoeUI 20 bold",fg="teal").pack(padx=5,pady=5)
e1=Entry(f2,textvariable=num,font="SegoeUI 14 bold",fg="black",bg="white",relief=SUNKEN,borderwidth=4,justify="center").pack(ipady=5)
f2.pack(fill=BOTH,padx=5,pady=10)
f3=Frame(root)
Label(f3,text="Enter OTP",font="SegoeUI 20 bold",fg="teal").pack(padx=5,pady=5)
e2=Entry(f3,textvariable=otp,font="SegoeUI 14 bold",fg="black",bg="white",relief=SUNKEN,borderwidth=5,justify="center").pack(ipady=5)
f3.pack(fill=BOTH,padx=5,pady=10)
f4=Frame(root)
Button(f4,text="Send OTP",command=send,font="SegoeUI 10 bold",fg="purple").pack(padx=20,pady=10,side=LEFT)
Button(f4,text="Check OTP",command=check,font="SegoeUI 10 bold",fg="purple").pack(padx=40,pady=10,side=LEFT)
f4.pack()
root.mainloop()