-
Notifications
You must be signed in to change notification settings - Fork 0
/
otp.js
41 lines (30 loc) · 1000 Bytes
/
otp.js
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
let target=new Date().getTime()+180000;
let x = setInterval(function(){
let now=new Date().getTime();
let dist=target-now;
let minutes = Math.floor((dist % (1000 * 60 * 60)) / (1000 * 60));
let seconds = Math.floor((dist % (1000 * 60)) / 1000);
// console.log( minutes + "m " + seconds + "s ");
document.querySelector("#exp").innerText=minutes + "m " + seconds + "s "
// otp recived
if (dist>179900){
alert("OTP is 1234")
}
// otp expires
if(dist<0){
history.back();
alert("OTP Expired");
}
})
document.querySelector("#otpbox>form").addEventListener("submit", function(event){
if (document.querySelector("#otpbox>form").OTP.value=="1234"){
window.location.href="index.html";
alert("Payment Successfull");
let empty=[];
localStorage.setItem("cart", JSON.stringify(empty));
}else{
window.location.href="Payment.html";
alert("Wrong OTP");
}
// console.log(document.querySelector("#otpbox>form").OTP.value);
})