Skip to content

Commit 11bd71a

Browse files
authored
auth-upgrade server landing page (#1624)
1 parent 8e007ca commit 11bd71a

File tree

1 file changed

+70
-26
lines changed

1 file changed

+70
-26
lines changed
Lines changed: 70 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,53 @@
1-
<!doctype html>
2-
<html lang="en">
3-
<head>
4-
<meta charset="utf-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1">
6-
<title>Welcome to Solid</title>
1+
<!doctype html><html><head>
2+
<meta charset="utf-8"/>
73
<link rel="stylesheet" href="/common/css/bootstrap.min.css">
84
<link rel="stylesheet" href="/common/css/solid.css">
9-
</head>
10-
<body>
11-
<div class="container">
12-
<div class="page-header">
13-
<div class="pull-right">
14-
<button id="register" type="button" class="btn btn-primary">Register</button>
15-
<button id="login" type="button" class="hidden btn btn-default btn-success">Log in</button>
16-
<button id="logout" type="button" class="hidden btn btn-danger">Log out</button>
17-
</div>
5+
<script>
6+
var keyname = 'SolidServerRootRedirectLink';
7+
document.addEventListener('DOMContentLoaded', async function() {
8+
if (!UI.authn.currentUser()) await UI.authn.checkUser();
9+
let user = UI.authn.currentUser();
10+
11+
// IF LOGGED IN: SET COOKIE. LOGOUT
12+
//
13+
if( user ) {
14+
window.localStorage.setItem(keyname,user.uri);
15+
await UI.authn.authSession.logout();
16+
}
17+
else {
18+
let webId = window.localStorage.getItem(keyname);
19+
20+
// IF NOT LOGGED IN AND COOKIE EXISTS: REMOVE COOKIE, HIDE WELCOME, SHOW LINK TO PROFILE
21+
//
22+
if( webId ) {
23+
window.localStorage.removeItem(keyname);
24+
document.getElementById('prototype').style.display = "none";
25+
document.getElementById('loggedIn').style.display = "block";
26+
document.getElementById('loggedIn').innerHTML = `<p>Your webId and profile address are</p> <p> &lt;${webId}&gt.</p><a href="${webId}">visit your profile to login</a></div>`;
27+
}
28+
29+
// IF NOT LOGGED IN AND COOKIE DOES NOT EXIST : SHOW WELCOME, SHOW LOGIN/SIGN-UP BUTTONS
30+
//
31+
else {
32+
document.getElementById('prototype').style.display = "block";
33+
document.getElementById('loginStatusArea').appendChild(UI.authn.loginStatusBox(document, null, {}))
34+
}
35+
36+
}
37+
})
38+
</script>
39+
<link href="/mash.css" rel="stylesheet">
40+
</head><body class="db-layout">
41+
42+
<h1 style="margin:2em;padding:2em;border:8px solid green; display:none" id="loggedIn"></h1>
1843

19-
<h1>Welcome to the Solid Prototype</h1>
20-
</div>
44+
<div id="prototype" class="container">
45+
46+
<div class="page-header">
47+
<h1>Welcome to the Solid Prototype</h1>
48+
<div id="loginStatusArea" class="pull-right"></div>
49+
</h1>
50+
</div>
2151

2252
<p class="lead">
2353
This is a prototype implementation of a Solid server.
@@ -27,11 +57,6 @@ <h1>Welcome to the Solid Prototype</h1>
2757
If you have not already done so, please create an account.
2858
</p>
2959

30-
<p class="lead hidden" id="loggedIn">
31-
You are logged in as
32-
<a href="#" id="profileLink"></a>.
33-
</p>
34-
3560
<section>
3661
{{#if serverLogo}}
3762
<img src="{{serverLogo}}" />
@@ -49,7 +74,26 @@ <h2>Server info</h2>
4974
</dl>
5075
</section>
5176
</div>
52-
<script src="/common/js/solid-auth-client.bundle.js"></script>
53-
<script src="/common/js/auth-buttons.js"></script>
54-
</body>
55-
</html>
77+
<header class="db-layout__header header" id="PageHeader"></header>
78+
<div class="TabulatorOutline db-layout__content" id="DummyUUID" role="main">
79+
<table id="outline"></table>
80+
<div id="GlobalDashboard"></div>
81+
</div><footer class="db-layout__footer" id="PageFooter"></footer>
82+
<style>
83+
#prototype {
84+
margin : 2em;
85+
padding : 1em;
86+
}
87+
#prototype input {
88+
margin : 1em;
89+
padding : 0.5em !important;
90+
}
91+
#loginStatusArea {
92+
float:right;
93+
clear:right;
94+
margin-top:-5em;
95+
}
96+
</style>
97+
98+
<script src="/mashlib.js"></script>
99+
</body></html>

0 commit comments

Comments
 (0)