forked from uforiginal/ClinicianView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
100 lines (80 loc) · 3.76 KB
/
index.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
<!DOCTYPE html>
<html lang = "en">
<head>
<meta charset="utf-8">
<title>Rhino Rehab: Sign In</title>
<!--style-->
<link rel="stylesheet" type="text/css" href="mystyle.css">
<link rel="stylesheet" type="text/css" href="skeleton.css">
<style>
.bookend{
height:100px;
vertical-align: top;
}
.flip{
transform: scale(-1,1);
}
</style>
<!--scripts-->
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="js/amazon-cognito-auth.min.js"></script>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.7.16.min.js"></script>
<script src="js/amazon-cognito-identity.min.js"></script>
<script src="js/config.js"></script>
</head>
<body>
<h1 style="padding: 4rem;"><center><h1><img src="Rhino.png" class="bookend" >Rhino Rehab<img src="Rhino.png" class="bookend flip"></h1></center></h1>
<center><h1 id="titleheader">Register</h1></center>
<center><input type="personalname" class="form-control" id="personalnameRegister" placeholder="Name" pattern=".*" required></center>
<center><input type="email" class="form-control" id="emailInputRegister" placeholder="Email" pattern=".*" required></center>
<center><input type="password" class="form-control" id="passwordInputRegister" placeholder="Password" pattern=".*" required></center>
<center><input type="password" class="form-control" id="confirmationpassword" placeholder="Confirm Password" pattern=".*" required></center>
<center><button id="mainbutton" class="btn btn-lg btn-primary btn-block" type="button" onclick="registerButton()" >Register</button></center>
<center><button id="signIn" type="button" onclick="window.location.href ='index2.html'" >Sign In</button></center>
</body>
<script>
var username;
var password;
var name;
var poolData;
function registerButton() {
personalName = document.getElementById("personalnameRegister").value;
username = document.getElementById("emailInputRegister").value;
if(document.getElementById("passwordInputRegister").value != document.getElementById("confirmationpassword").value){
alert("passwords do not match")
throw "passwords do not match"
} else {
password = document.getElementById("passwordInputRegister").value;
}
poolData = {
UserPoolId : _config.cognito.userPoolId,
ClientId : _config.cognito.clientId,
};
var userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData);
var attributeList = [];
var dataEmail = {
Name : 'email',
Value : username,
};
var dataPersonalName = {
Name : 'name',
Value : personalName,
};
var attributeEmail = new AmazonCognitoIdentity.CognitoUserAttribute(dataEmail);
var attributePersonalName = new AmazonCognitoIdentity.CognitoUserAttribute(dataPersonalName);
attributeList.push(attributeEmail);
attributeList.push(attributePersonalName);
userPool.signUp(username, password, attributeList, null, function(err, result)
{
if(err)
{
alert(err.message || JSON.stringify(err));
return;
}
cognitoUser = result.user;
console.log('user name is ' + cognitoUser.getUsername());
document.getElementById("titleheader").innerHTML = "Check your email for a verification link";
});
}
</script>
</html>