-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
228 lines (228 loc) · 9.18 KB
/
Copy pathindex.html
File metadata and controls
228 lines (228 loc) · 9.18 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
<script src="jquery.inputmask.bundle.js"></script>
</head>
<body>
<div class="container">
<div id="requestbox" style="margin-top:50px;" class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
<div class="panel panel-info">
<div class="panel-heading">
<div class="panel-title">Verify Your Mobile Number</div>
</div>
<div style="padding-top:30px" class="panel-body">
<div style="display:none" id="login-alert" class="alert alert-danger col-sm-12"></div>
<form class="form-horizontal">
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-phone"></i></span>
<input type="text" class="form-control" name="phone" id="phone" value="" placeholder="Your Mobile Number" onkeyup="numberOnly(this)">
</div>
<div style="margin-top:10px" class="form-group">
<div class="col-sm-12 controls">
<button type="button" id="btn-verify" class="btn btn-success" data-loading-text="please wait" onclick="reqToken()">Request</button>
</div>
</div>
<div class="form-group">
<div class="col-md-12 control">
<div style="border-top: 1px solid#888; padding-top:15px; font-size:85%">
Powered By
<a href="https://citcall.com">Citcall</a>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div id="validatebox" style="display:none; margin-top:50px" class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
<div class="panel panel-info">
<div class="panel-heading">
<div class="panel-title" id="infovalidate"></div>
</div>
<div class="panel-body">
<form id="signupform" class="form-horizontal">
<div class="form-group">
<label for="code" class="col-md-3 control-label">Input Code</label>
<div class="col-md-9">
<input type="text" class="form-control" id="code" name="code" placeholder="Input Caller">
</div>
</div>
<div class="form-group">
<div class="col-md-offset-3 col-md-9">
<button id="btn-validate" type="button" class="btn btn-info" data-loading-text="please wait" onclick="verifyCode()">Verify</button>
</div>
<div class="pull-right" id="retry-div"><p>Didn't receive call? <button onclick="retryVerify()">Try Again</button> </p></div>
</div>
</form>
</div>
</div>
</div>
<div id="resultbox" style="display:none; margin-top:50px" class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
<div class="panel panel-info">
<div class="panel-heading">
<div class="panel-title" id="infovalidate"></div>
</div>
<div class="panel-body">
<center>
<img class="profile-img" src="verified.png" alt="">
</center>
</div>
</div>
</div>
</div>
<script>
var trxid = '';
var btnVerify = $('#btn-verify');
var btnValidate = $('#btn-validate');
var msisdn = '';
var retry = 0;
var maximumRetry = 3;
var lengthToken = 0;
var validateTry = 0;
var maxValidateTry = 10;
$(document).ready(function(){
$("#phone").keypress(function(e){
var key = e.which;
if (key == 13) {
$("#btn-verify").click();
return false;
}
});
$('#code').on('input', function() {
var value = $('#code').val();
var res = value.replace("x", "");
if (res.length == lengthToken) {
verifyCode();
}
});
});
function numberOnly(ob) {
var invalidChars = /[^0-9]/gi
if(invalidChars.test(ob.value)) {
ob.value = ob.value.replace(invalidChars,"");
}
}
function showRetry(){
$('#retry-div').hide();
setTimeout(function() {
$('#retry-div').show();
}, 10000);
}
function reqToken() {
msisdn = $('#phone').val();
if(msisdn != '') {
$.ajax({
url: "req_otp.php",
method: "POST",
timeout: 0,
data:{
'phone':msisdn
},
beforeSend: function(){
btnVerify.button('loading');
},
success: function(msg){
if(msg.error === true){
alert(msg.info);
}else{
trxid = msg.trxid;
$("#code").inputmask(msg.first_token + "9999",{placeholder: "x",});
lengthToken = msg.length;
$('#infovalidate').text('You will be miscalled from ' + msg.first_token + 'xxxx fill the last 4 digit');
$('#requestbox').hide();
$('#validatebox').show();
showRetry();
}
},
error: function(jqXHR, textStatus, errorThrown){
alert(textStatus);
},
complete: function(){
btnVerify.button('reset');
}
});
}
}
function retryVerify() {
retry = retry + 1;
if(retry < maximumRetry) {
$('#retry-div').hide();
$.ajax({
url: "req_otp.php",
method: "POST",
timeout: 0,
data:{
'phone':msisdn
},
beforeSend: function(){
$('#btn-validate').prop('disabled',true);
},
success: function(msg){
if(msg.error === true){
alert(msg.info);
}else{
trxid = msg.trxid;
lengthToken = msg.length;
$("#code").inputmask(msg.first_token + "9999",{placeholder: "x",});
$('#infovalidate').text('You will be miscalled from ' + msg.first_token + 'xxxx fill the last 4 digit');
showRetry();
}
},
error: function(jqXHR, textStatus, errorThrown){
alert(textStatus);
},
complete: function(){
$('#btn-validate').prop('disabled',false);
}
});
} else {
alert('maximum retry reached!');
$('#retry-div').hide();
$('#code').val('');
}
}
function verifyCode(){
var code = $('#code').val();
if(code != ''){
validateTry = validateTry + 1;
if(validateTry < maxValidateTry) {
$.ajax({
url: "verify_code.php",
method: "POST",
timeout: 0,
data:{
'code':code,
'trxid':trxid
},
beforeSend: function(){
btnValidate.button('reset');
},
success: function(msg){
if(msg.error === true){
alert(msg.info);
}else{
$('#requestbox').hide();
$('#validatebox').hide();
$('#resultbox').show();
}
},
error: function(jqXHR, textStatus, errorThrown){
alert(textStatus);
},
complete: function(){
btnValidate.button('reset');
}
});
} else {
alert('Maximum attempt reached!');
location.reload();
}
}
}
</script>
</body>
</html>