forked from uforiginal/ClinicianView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.html
77 lines (56 loc) · 1.79 KB
/
main.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Rhino Rehab: Clinician View</title>
<!--Style-->
<link rel="stylesheet" type="text/css" href="mystyle.css">
<link rel="stylesheet" type="text/css" href="skeleton.css">
<!--Scripts-->
<script src="js/amazon-cognito-identity.min.js"></script>
<script src="js/config.js"></script>
<script src="mainscript.js"></script>
</head>
<body>
<div>
<div style="text-align: right; padding: 2rem;">
<label for="email_value">Welcome back</span></label><label id="email_value"></label>
<button type="button" onclick="signOut()">Log out</button>
</button>
</div>
</div>
<script>
var poolData = {
UserPoolId : _config.cognito.userPoolId,
ClientId : _config.cognito.clientId,
};
var userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData);
var cognitoUser = userPool.getCurrentUser();
window.onload = function(){
if(cognitoUser != null){
cognitoUser.getSession(function(err,session){
if(err){
alert(err);
return;
}
console.log('session validity: ' + session.isValid());
cognitoUser.getUserAttributes(function(err, result){
if(err){
console.log(err);
return;
}
console.log(result);
document.getElementById("email_value").innerHTML = result[2].getValue();
});
});
}
}
function signOut(){
if(cognitoUser != null){
cognitoUser.signOut();
location.href='index2.html';
}
}
</script>
</body>
</html>