forked from gabrielsroka/gabrielsroka.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
home-ie.htm
61 lines (61 loc) · 1.84 KB
/
home-ie.htm
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
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My Apps</title>
<link href="https://ok1static.oktacdn.com/assets/css/enduser/enduser.css" type="text/css" rel="stylesheet" />
<style>
.app-button-wrapper {
width: 64px;
}
.app-button .logo {
visibility: visible;
}
.app-button-name {
width: 100%;
}
</style>
</head>
<body>
<br>
<nav>
<a id="home"><span class="inline-icon icon-home-light"></span><span>Home</span></a> -
<a href="/login.htm?signout">Sign out</a>
<br>
</nav>
<br>
<main>
<div id="app"></div>
</main>
<script>
var baseUrl = "https://gsroka-neto.oktapreview.com";
// For this to work, enable CORS in Okta: Security > API > Trusted Origins > Add Origin > CORS.
var request = new XMLHttpRequest();
request.open('GET', baseUrl + '/api/v1/users/me/appLinks');
request.withCredentials = true;
request.onload = function () {
var links = JSON.parse(this.responseText);
var lis = "";
links.sort(function (link1, link2) {return link1.sortOrder < link2.sortOrder ? -1 : 1;})
.forEach(function (link) {
var parts = link.label.split(/,/);
var label = parts[0], url = parts[1];
if (url !== undefined) {
url = url.trim();
if (url === "") url = label.replace(/ /g, "");
if (!url.match(/^https/)) url = "https://" + url;
if (!url.match(/\./)) url += ".com";
lis += "<li class='app-button-wrapper'>" +
"<a href='" + url + "' target='_blank' class='app-button' rel='noopener'>" +
"<img src='" + url + "/favicon.ico' class='logo'/></a>" +
"<p class='app-button-name'>" + label;
}
});
home.href = baseUrl;
app.innerHTML = "<ul>" + lis + "</ul>";
};
request.onerror = function () {location.href = "/login.htm";};
request.send();
</script>
</body>
</html>