forked from avaibh/Smart-Door-Authentication-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OTPlogin.html
73 lines (64 loc) · 3.05 KB
/
OTPlogin.html
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
<!DOCTYPE html>
<html>
<head>
<title>OTP Validation Page</title>
<script src="https://code.jquery.com/jquery-2.1.4.js" type="text/javascript"></script>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="js/lib/axios/dist/axios.standalone.js"></script>
<script type="text/javascript" src="js/lib/CryptoJS/rollups/hmac-sha256.js"></script>
<script type="text/javascript" src="js/lib/CryptoJS/rollups/sha256.js"></script>
<script type="text/javascript" src="js/lib/CryptoJS/components/hmac.js"></script>
<script type="text/javascript" src="js/lib/CryptoJS/components/enc-base64.js"></script>
<script type="text/javascript" src="js/lib/url-template/url-template.js"></script>
<script type="text/javascript" src="js/lib/apiGatewayCore/sigV4Client.js"></script>
<script type="text/javascript" src="js/lib/apiGatewayCore/apiGatewayClient.js"></script>
<script type="text/javascript" src="js/lib/apiGatewayCore/simpleHttpClient.js"></script>
<script type="text/javascript" src="js/lib/apiGatewayCore/utils.js"></script>
<script type="text/javascript" src="js/apigClient.js"></script>
<script>
function my_submit() {
var apigClient = apigClientFactory.newClient();
var params = {
//This is where any header, path, or querystring request params go. The key is the parameter named as defined in the API
};
var link = window.location.href;
var faceId
if(link){
params = link.split('?')[1]
temp = params.split('=')
if(temp[0] == "faceId")
faceId = temp[1]
}
console.log(faceId)
var body = {
//This is where you define the body of the request
'message': {
'otp': document.getElementById("OTP").value,
'faceId' : faceId
}
}
var additionalParams = {}
apigClient.oTPValidatePost(params, body, additionalParams)
.then(function (result) {
alert(result.data.body);
console.log(result);
}).catch(function (result) {
//This is where you would put an error callback
console.log(result);
});
};
</script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div align="center">
<h2 alignment ="center">OTP Validation Page</h2>
One Time Password (OTP):<br>
<input id="OTP" type="text">
<br><br>
<button id="user-input-button" onclick="my_submit()"> SUBMIT</button><br><br>
<p>If you have entered the correct OTP you will be given access to the Door</p>
</div>
</body>
</html>