-
Notifications
You must be signed in to change notification settings - Fork 9
/
verify.html
143 lines (117 loc) · 5.88 KB
/
verify.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
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
<html>
<head>
<title>Verify</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<div class="container">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">AWS User Pool Boilerplate</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="./index.html">Readme</a>
</li>
<li>
<a href="./login.html">Login</a>
</li>
<li>
<a href="./register.html">Register</a>
</li>
<li class="active">
<a href="./verify.html">Verify</a>
</li>
<li>
<a href="./restricted.html"><i class="glyphicon glyphicon-lock"></i> Restricted Page</a>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container-fluid -->
</nav>
<div class="col-md-3"></div>
<div class="well panel panel-default col-md-6">
<div class="panel-body">
<center>
<h1>Verify</h1>
<br>
</center>
<form class="form-horizontal">
<fieldset>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="email">Email</label>
<div class="col-md-6">
<input id="email" name="email" type="email" placeholder="Email" class="form-control input-md" required="">
</div>
</div>
<!-- Password input-->
<div class="form-group">
<label class="col-md-4 control-label" for="Verification">Verification code</label>
<div class="col-md-6">
<input id="Verification" name="Verification" type="password" placeholder="Verification Code" class="form-control input-md" required="">
</div>
</div>
<!-- Button -->
<div>
<label class="col-md-4 control-label" for="login"></label>
<div class="col-md-4">
<button onclick="verify();return false;" class="btn btn-lg btn-warning">Verify</button>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
<!-- /container -->
<script src="assets/js/jquery-3.1.1.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/jsbn.js"></script>
<script src="assets/js/jsbn2.js"></script>
<script src="assets/js/sjcl.js"></script>
<script src="assets/js/aws-cognito-sdk.min.js"></script>
<script src="assets/js/amazon-cognito-identity.min.js"></script>
<script src="assets/js/aws-sdk-2.5.0.min.js"></script>
<script>
$("button").click(function(event) {
event.preventDefault();
});
function verify() {
AWSCognito.config.region = 'eu-west-1';
var email = document.getElementById("email").value;
var verification = document.getElementById("Verification").value;
var poolData = {
UserPoolId: 'eu-west-1_ZoHJNu0UM', // your user pool id here
ClientId: '6suoip8tmdsgv8gi64m42l9493' // your app client id here
};
var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(poolData);
var userData = {
Username: email,
Pool: userPool
};
var cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
cognitoUser.confirmRegistration(verification, true, function(err, result) {
if (err) {
$(".well").prepend('<div class="alert alert-danger"> <strong>Something went Wrong !<br></strong>'+err+'</div>');
return;
}else{
$(".well").prepend('<div class="alert alert-success"> <strong>Successfully Verified !<br></strong> Now you can login : please click <a href="./login.html"><strong>here</strong></a><br>Thank You!. </div>');
}
});
};
</script>
</body>
</html>